Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

20 lines
804 B
TypeScript

import { describe, it, expect } from 'vitest';
import { getArgValue } from './get-arg-value.js';
describe('getArgValue helper', () => {
it('should throw if there no arguments', () => {
const args = ['/Path/to/node', '/Path/to/script'];
expect(() => getArgValue(args)).toThrow('only one argument allowed');
});
it('should throw if the argument is not an integer', () => {
expect.assertions(3);
const args = ['/Path/to/node', '/Path/to/script', 'num=4'];
expect(() => getArgValue(args)).toThrow('argument must be an integer');
const args2 = ['/Path/to/node', '/Path/to/script', '4.1'];
expect(() => getArgValue(args2)).toThrow('argument must be an integer');
const args3 = ['/Path/to/node', '/Path/to/script', '4'];
expect(getArgValue(args3)).toBe(4);
});
});