Add user mapping test

This commit is contained in:
Henrik Hüttemann
2023-05-26 17:42:03 +02:00
parent f81cf1e1fb
commit ed2b206f18
5 changed files with 5410 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
process.env.REGISTRATION_SHARED_SECRET = 'ThisIsSoSecretWow'
import { RcUser, MatrixUser, mapUser } from './users'
const rcUser: RcUser = {
_id: 'testRc',
name: 'Tester',
username: 'test',
roles: ['user'],
__rooms: [],
}
const matrixUser: MatrixUser = {
user_id: '',
username: rcUser.username,
displayname: rcUser.name,
password: '',
admin: false,
}
test('mapping users', () => {
expect(mapUser(rcUser)).toStrictEqual(matrixUser)
})
+1 -1
View File
@@ -3,10 +3,10 @@ import { axios } from './synapse'
import { createHmac } from 'node:crypto'
export type RcUser = {
_id: string
username: string
name: string
roles: string[]
_id: string
__rooms: string[]
}