diff --git a/api/package.json b/api/package.json index efaedb577f9..f8c53e9fa54 100644 --- a/api/package.json +++ b/api/package.json @@ -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" } diff --git a/api/utils/index.test.ts b/api/utils/index.test.ts new file mode 100644 index 00000000000..6b6eb6bff52 --- /dev/null +++ b/api/utils/index.test.ts @@ -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); + }); +});