help.argumentDescription.test.js
This file
Path
tests/help.argumentDescription.test.js
49 lines · 1.8 KiB · JavaScript
Last changed by
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
History of this fileTake it
The walk stopped after 200 commits: lines older than 471ec40 point at it.
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
lines 1–3why, one step back1import * as commander from '../index.js';2import { test, describe } from 'node:test';3import assert from 'node:assert/strict';Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 4–6why, one step back45// These are tests of the Help class, not of the Command help.6Add describe wrappers so test output makes sense without filenames (#2472)John Geebefore adoptionb3e6795
line 7why, one step back7describe('Help.argumentDescription()', () => {Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 8–10why, one step back8 test('when argument has no description then empty string', () => {9 const argument = new commander.Argument('[n]');10 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 11why, one step back11 assert.equal(helper.argumentDescription(argument), '');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 12–17why, one step back12 });1314 test('when argument has description then return description', () => {15 const description = 'description';16 const argument = new commander.Argument('[n]', description);17 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 18why, one step back18 assert.equal(helper.argumentDescription(argument), description);Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 19–21why, one step back19 });2021 test('when argument has default value then return description and default value', () => {Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 22–24why, one step back22 const argument = new commander.Argument('[n]', 'description').default(23 'default',24 );Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 25why, one step back25 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 26–27why, one step back26 assert.equal(27 helper.argumentDescription(argument),Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 28–29why, one step back28 'description (default: "default")',29 );Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 30–32why, one step back30 });3132 test('when argument has default value description then return description and custom default description', () => {Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 33–36why, one step back33 const argument = new commander.Argument('[n]', 'description').default(34 'default value',35 'custom',36 );Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
line 37why, one step back37 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
lines 38–39why, one step back38 assert.equal(39 helper.argumentDescription(argument),Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 40–41why, one step back40 'description (default: custom)',41 );Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 42–46why, one step back42 });4344 test('when an argument has default value and no description then still return default value', () => {45 const argument = new commander.Argument('[n]').default('default');46 const helper = new commander.Help();Switch from Jest to Node.js built-in test runner (#2463)John Geebefore adoption3dd6086
line 47why, one step back47 assert.equal(helper.argumentDescription(argument), '(default: "default")');Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 48–49why, one step back48 });49});