feat(api): add node:test (#48437)

This commit is contained in:
Shaun Hamilton
2022-11-09 08:40:21 +00:00
committed by Mrugesh Mohapatra
parent f7644bec68
commit 37ed23ef38
2 changed files with 20 additions and 1 deletions
+2 -1
View File
@@ -33,8 +33,9 @@
},
"scripts": {
"build": "tsc index.ts",
"develop": "nodemon index.ts",
"start": "NODE_ENV=production node index.js",
"develop": "nodemon index.ts"
"test": "NODE_OPTIONS='--test-only' ts-node **/*.test.ts"
},
"version": "0.0.1"
}
+18
View File
@@ -0,0 +1,18 @@
import assert from 'node:assert';
// eslint-disable-next-line import/no-unresolved
import { describe, it } from 'node:test';
import { base64URLEncode, challenge, verifier } from '.';
describe('utils', { only: true }, () => {
it('base64URLEncode', () => {
assert.strictEqual(base64URLEncode(Buffer.from('test')), 'dGVzdA');
});
it('verifier', () => {
const v = verifier;
assert.strictEqual(v.length, 43);
});
it('challenge', () => {
const c = challenge;
assert.strictEqual(c.length, 43);
});
});