From aa25e90d709a688877fe8f940e84871c7627cbf5 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sun, 6 Sep 2026 23:23:57 -0700 Subject: [PATCH] Delete redundant settings `{ concurrency: true }` already flows down from the surrounding `suite`, there is no need to pass it again on each `test`. --- test/crypto.test.js | 20 ++++++++++---------- test/utils.test.js | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/test/crypto.test.js b/test/crypto.test.js index a87b37f..e6b868f 100644 --- a/test/crypto.test.js +++ b/test/crypto.test.js @@ -9,25 +9,25 @@ const prf = Uint8Array.fromHex('deadbeef0000000000000000000000000000000000000000 const value = '🏴‍☠️ Hello, world!'; suite('encryptRaw and decryptRaw', { concurrency: true }, () => { - test('works on simple string', { concurrency: true }, async () => { + test('works on simple string', async () => { deepStrictEqual(await encryptRaw({ version, prf, value }).then(value => decryptRaw({ prf, value })), value); }); }); suite('encryptRaw', { concurrency: true }, () => { - test('throws on invalid version', { concurrency: true }, async () => { + test('throws on invalid version', async () => { // @ts-expect-error await rejects(encryptRaw({ version: 'INVALID', prf, value }), { name: 'TypeError', message: 'envpass version "INVALID" is not supported.' }); }); - test('throws on invalid prf', { concurrency: true }, async () => { + test('throws on invalid prf', async () => { // @ts-expect-error await rejects(encryptRaw({ version, prf: 'INVALID', value }), { name: 'TypeError', message: 'prf "INVALID" is not an ArrayBuffer or Uint8Array.' }); }); - test('throws on invalid value', { concurrency: true }, async () => { + test('throws on invalid value', async () => { // @ts-expect-error await rejects(encryptRaw({ version, prf, value: {} }), { name: 'TypeError', message: 'Value "{}" is not a string.' }); }); - test('output value does not have base64 padding', { concurrency: true }, async () => { + test('output value does not have base64 padding', async () => { for (const value of ['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa', 'aaaaaa', 'aaaaaaa']) { const output = await encryptRaw({ version, prf, value }); notDeepStrictEqual(output.at(-1), '='); @@ -37,23 +37,23 @@ suite('encryptRaw', { concurrency: true }, () => { suite('decryptRaw', { concurrency: true }, () => { const value = 'envpass:v1:AAA'; - test('throws on invalid prf', { concurrency: true }, async () => { + test('throws on invalid prf', async () => { // @ts-expect-error await rejects(decryptRaw({ prf: 'INVALID', value }), { name: 'TypeError', message: 'prf "INVALID" is not an ArrayBuffer or Uint8Array.' }); }); - test('throws on invalid value', { concurrency: true }, async () => { + test('throws on invalid value', async () => { // @ts-expect-error await rejects(decryptRaw({ prf, value: {} }), { name: 'TypeError', message: 'Value "{}" is not a string.' }); }); - test('throws on invalid magic in value', { concurrency: true }, async () => { + test('throws on invalid magic in value', async () => { // @ts-expect-error await rejects(decryptRaw({ prf, value: 'INVALID:v1:AAA' }), { name: 'TypeError', message: 'Value "INVALID:v1:AAA" is not an envpass encrypted value.' }); }); - test('throws on invalid version in value', { concurrency: true }, async () => { + test('throws on invalid version in value', async () => { // @ts-expect-error await rejects(decryptRaw({ prf, value: 'envpass:INVALID:AAA' }), { name: 'TypeError', message: 'envpass version "INVALID" is not supported.' }); }); - test('throws on invalid (non-base64) string in value', { concurrency: true }, async () => { + test('throws on invalid (non-base64) string in value', async () => { await rejects(decryptRaw({ prf, value: 'envpass:v1:🏴‍☠️' }), { name: 'SyntaxError', message: 'Found a character that cannot be part of a valid base64 string.' }); }); }); \ No newline at end of file diff --git a/test/utils.test.js b/test/utils.test.js index 51d6e08..1eabdb4 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -11,13 +11,13 @@ suite('toEnvString', { concurrency: true }, () => { { name: 'simple object', obj: { a: '1', b: '2', c: '3' }, str: 'a=1\nb=2\nc=3\n' }, ]; for (const { name, obj, str } of vectors) { - test(`converts: ${name}`, { concurrency: true }, () => { + test(`converts: ${name}`, () => { deepStrictEqual(toEnvString(obj), str); }); - test(`inverses parseEnv for: ${name}`, { concurrency: true }, () => { + test(`inverses parseEnv for: ${name}`, () => { deepStrictEqual(toEnvString(parseEnv(str)), str); }); - test(`is inverse of parseEnv for: ${name}`, { concurrency: true }, () => { + test(`is inverse of parseEnv for: ${name}`, () => { const env = Object.create(null); Object.assign(env, obj); deepStrictEqual(parseEnv(toEnvString(env)), env); @@ -41,7 +41,7 @@ suite('parseEnvpassEncrypted', { concurrency: true }, () => { { name: 'rejects leading whitespace', input: ' envpass:v1:rXAhBNXZFsLl8EtZm3GHAZttZyLYP3j97Yy4qly53wBodRyyKYi8PlxjOlggc7mVLA/HoME4QSKdhuEs3C4UKvo0J3ZAV+JbrzfZbsBJ3tvvG4/UEVxB1+0IPoUyjhoO' }, ]; for (const { name, input } of rejects) { - test(name, { concurrency: true }, () => { + test(name, () => { deepStrictEqual(parseEnvpassEncrypted(input), null); }); } @@ -49,23 +49,23 @@ suite('parseEnvpassEncrypted', { concurrency: true }, () => { { name: 'accepts envpass encrypted string', input: 'envpass:v1:rXAhBNXZFsLl8EtZm3GHAZttZyLYP3j97Yy4qly53wBodRyyKYi8PlxjOlggc7mVLA/HoME4QSKdhuEs3C4UKvo0J3ZAV+JbrzfZbsBJ3tvvG4/UEVxB1+0IPoUyjhoO' }, ]; for (const { name, input } of accepts) { - test(name, { concurrency: true }, () => { + test(name, () => { deepStrictEqual(parseEnvpassEncrypted(input), input); }); } }); suite('InputError', { concurrency: true }, () => { - test('is throwable', { concurrency: true }, () => { + test('is throwable', () => { throws(() => { throw new InputError(); }, InputError); }); - test('inherits Error', { concurrency: true }, () => { + test('inherits Error', () => { ok(new InputError() instanceof Error); }); - test('sets name to "InputError"', { concurrency: true }, () => { + test('sets name to "InputError"', () => { deepStrictEqual(new InputError().name, 'InputError'); }); - test('accepts string message', { concurrency: true }, () => { + test('accepts string message', () => { const msg = 'TEST'; deepStrictEqual(new InputError(msg).message, msg); }); -- 2.47.3