argument.chain.test.js
This file
Path
tests/argument.chain.test.js
35 lines · 1.1 KiB · JavaScript
Last changed by
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536import { Argument } from '../index.js';import { test, describe } from 'node:test';import assert from 'node:assert/strict';
describe('Argument methods that should return this for chaining', () => { test('when call .default() then returns this', () => { const argument = new Argument('<value>'); const result = argument.default(3); assert.equal(result, argument); });
test('when call .argParser() then returns this', () => { const argument = new Argument('<value>'); const result = argument.argParser(() => {}); assert.equal(result, argument); });
test('when call .choices() then returns this', () => { const argument = new Argument('<value>'); const result = argument.choices(['a']); assert.equal(result, argument); });
test('when call .argRequired() then returns this', () => { const argument = new Argument('<value>'); const result = argument.argRequired(); assert.equal(result, argument); });
test('when call .argOptional() then returns this', () => { const argument = new Argument('<value>'); const result = argument.argOptional(); assert.equal(result, argument); });});