update helpers
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
/** 构造一个 fake JWT,payload 中包含给定 role */
|
||||||
|
export function fakeJwtWithRole(role: string): string {
|
||||||
|
const header = btoa(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))
|
||||||
|
const payload = btoa(JSON.stringify({ uid: 1, role, s: 'random' }))
|
||||||
|
return `${header}.${payload}.fake-signature`
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 通用有效 JWT token(accessor 角色),用于不关心具体角色的测试场景 */
|
||||||
|
export const VALID_TOKEN = fakeJwtWithRole('accessor')
|
||||||
|
export const VALID_REFRESH_TOKEN = 'valid-refresh-token'
|
||||||
Reference in New Issue
Block a user