mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 09:45:37 -04:00
Move old backend code to old_src folder
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
c42d2223e8
commit
7b9f9a487b
97 changed files with 7 additions and 7 deletions
51
old_src/test/letter-avatars.ts
Normal file
51
old_src/test/letter-avatars.ts
Normal file
|
@ -0,0 +1,51 @@
|
|||
/* eslint-env node, mocha */
|
||||
|
||||
'use strict'
|
||||
|
||||
import { ImportMock } from 'ts-mock-imports'
|
||||
import * as configModule from '../lib/config'
|
||||
|
||||
import assert from 'assert'
|
||||
import * as avatars from '../lib/letter-avatars'
|
||||
|
||||
describe('generateAvatarURL() gravatar enabled', function () {
|
||||
beforeEach(function () {
|
||||
// Reset config to make sure we don't influence other tests
|
||||
const testconfig = {
|
||||
allowGravatar: true,
|
||||
serverURL: 'http://localhost:3000',
|
||||
port: 3000
|
||||
}
|
||||
ImportMock.mockOther(configModule, 'config', testconfig)
|
||||
})
|
||||
|
||||
it('should return correct urls', function () {
|
||||
assert.strictEqual(avatars.generateAvatarURL('Daan Sprenkels', 'hello@dsprenkels.com', true), 'https://cdn.libravatar.org/avatar/d41b5f3508cc3f31865566a47dd0336b?s=400')
|
||||
assert.strictEqual(avatars.generateAvatarURL('Daan Sprenkels', 'hello@dsprenkels.com', false), 'https://cdn.libravatar.org/avatar/d41b5f3508cc3f31865566a47dd0336b?s=96')
|
||||
})
|
||||
|
||||
it('should return correct urls for names with spaces', function () {
|
||||
assert.strictEqual(avatars.generateAvatarURL('Daan Sprenkels'), 'http://localhost:3000/user/Daan%20Sprenkels/avatar.svg')
|
||||
})
|
||||
})
|
||||
|
||||
describe('generateAvatarURL() gravatar disabled', function () {
|
||||
beforeEach(function () {
|
||||
// Reset config to make sure we don't influence other tests
|
||||
const testconfig = {
|
||||
allowGravatar: false,
|
||||
serverURL: 'http://localhost:3000',
|
||||
port: 3000
|
||||
}
|
||||
ImportMock.mockOther(configModule, 'config', testconfig)
|
||||
})
|
||||
|
||||
it('should return correct urls', function () {
|
||||
assert.strictEqual(avatars.generateAvatarURL('Daan Sprenkels', 'hello@dsprenkels.com', true), 'http://localhost:3000/user/Daan%20Sprenkels/avatar.svg')
|
||||
assert.strictEqual(avatars.generateAvatarURL('Daan Sprenkels', 'hello@dsprenkels.com', false), 'http://localhost:3000/user/Daan%20Sprenkels/avatar.svg')
|
||||
})
|
||||
|
||||
it('should return correct urls for names with spaces', function () {
|
||||
assert.strictEqual(avatars.generateAvatarURL('Daan Sprenkels'), 'http://localhost:3000/user/Daan%20Sprenkels/avatar.svg')
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue