Skip to content

Commit 2b95b0e

Browse files
committed
chore: fix tests
1 parent e0ab216 commit 2b95b0e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/utils/auth.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import { errorWithResponse } from './http.js';
1616
* @param {Context} ctx
1717
*/
1818
export async function assertAuthorization(ctx) {
19-
let actual;
19+
let actual = ctx.attributes.key;
2020
if (typeof ctx.attributes.key === 'undefined') {
2121
ctx.attributes.key = ctx.info.headers.authorization?.slice('Bearer '.length);
2222
actual = ctx.attributes.key;
2323
}
2424
if (actual === ctx.env.SUPERUSER_KEY) {
25-
ctx.log.info('acting as superuser');
25+
ctx.log.debug('acting as superuser');
2626
return;
2727
}
2828

test/fixtures/context.js

+6
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ export const DEFAULT_CONTEXT = (
3131
log: console,
3232
...overrides,
3333
attributes: {
34+
key: 'test-key',
3435
...(overrides.attributes ?? {}),
3536
},
3637
env: {
38+
SUPERUSER_KEY: 'su-test-key',
39+
KEYS: {
40+
// @ts-ignore
41+
get: async () => 'test-key',
42+
},
3743
CONFIGS: {
3844
// @ts-ignore
3945
get: async (id) => configMap[id],

0 commit comments

Comments
 (0)