mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
test language, make pubkey unique, migrations dir from config
This commit is contained in:
parent
dc6459f45c
commit
5c79d34ef3
@ -185,6 +185,25 @@ describe('UserResolver', () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('unknown language', () => {
|
||||
it('sets "de" as default language', async () => {
|
||||
await mutate({
|
||||
mutation,
|
||||
variables: { ...variables, email: 'bibi@bloxberg.de', language: 'es' },
|
||||
})
|
||||
await expect(
|
||||
getRepository(LoginUser).createQueryBuilder('login_user').getMany(),
|
||||
).resolves.toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
email: 'bibi@bloxberg.de',
|
||||
language: 'de',
|
||||
}),
|
||||
]),
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ import { signIn } from '../../apis/KlicktippController'
|
||||
import { RIGHTS } from '../../auth/RIGHTS'
|
||||
import { ServerUserRepository } from '../../typeorm/repository/ServerUser'
|
||||
import { ROLE_ADMIN } from '../../auth/ROLES'
|
||||
import { randomBytes } from 'crypto'
|
||||
|
||||
const EMAIL_OPT_IN_RESET_PASSWORD = 2
|
||||
const EMAIL_OPT_IN_REGISTER = 1
|
||||
@ -432,7 +433,7 @@ export class UserResolver {
|
||||
dbUser.lastName = lastName
|
||||
dbUser.username = username
|
||||
// TODO this field has no null allowed unlike the loginServer table
|
||||
dbUser.pubkey = Buffer.alloc(32, 0) // default to 0000...
|
||||
dbUser.pubkey = Buffer.from(randomBytes(32)) // Buffer.alloc(32, 0) default to 0000...
|
||||
// dbUser.pubkey = keyPair[0]
|
||||
|
||||
await queryRunner.manager.save(dbUser).catch((er) => {
|
||||
|
||||
@ -18,7 +18,7 @@ const migration = new Migration({
|
||||
conn: pool,
|
||||
tableName: CONFIG.MIGRATIONS_TABLE,
|
||||
silent: true,
|
||||
dir: '../database/migrations/', // CONFIG.MIGRATIONS_DIRECTORY,
|
||||
dir: CONFIG.MIGRATIONS_DIRECTORY,
|
||||
})
|
||||
|
||||
const initialize = async (): Promise<void> => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user