Add user mapping test
This commit is contained in:
@@ -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
@@ -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[]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user