chore: fix the tests for node 14

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-05-05 12:36:25 +02:00
parent 5af8f5b1fe
commit 36441d9927
2 changed files with 3 additions and 5 deletions
@@ -233,8 +233,6 @@ describe('createRouter', () => {
),
);
await new Promise(resolve => setTimeout(resolve, 1000));
expect(broker).toHaveBeenCalledWith(
expect.objectContaining({
createdBy: 'user:default/guest',
@@ -285,8 +283,6 @@ describe('createRouter', () => {
},
});
await new Promise(resolve => setTimeout(resolve, 1000));
expect(broker).toHaveBeenCalledWith(
expect.objectContaining({
createdBy: undefined,
@@ -342,7 +342,9 @@ function parseBearerToken(header?: string): {
if (!token) return {};
const [_header, rawPayload, _signature] = token.split('.');
const payload: { sub: string } = JSON.parse(atob(rawPayload));
const payload: { sub: string } = JSON.parse(
Buffer.from(rawPayload, 'base64').toString(),
);
return {
entityRef: payload.sub,