Skip to content

Commit

Permalink
Test: Default value should be present in file
Browse files Browse the repository at this point in the history
  • Loading branch information
mensah-j committed May 14, 2024
1 parent 319e72a commit b9978e2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/inquirer/test/specs/prompts/editor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ const defaultVisual = process.env.VISUAL;

const require = createRequire(import.meta.url);
const writeBin = require.resolve('../../bin/write.js');
const expectedAnswer = 'testing';

describe('`editor` prompt', () => {
describe.each([
{ message: 'testing', expectedAnswer: 'testing' },
{ message: '', expectedAnswer: fixtures.editor.default },
])('`editor` prompt', ({ message, expectedAnswer }) => {
let fixture;
let rl;

beforeEach(() => {
// Writes the word "testing" to the file
process.env.VISUAL = `node ${writeBin} ${expectedAnswer}`;
// If supplied, overwrites the file with message
process.env.VISUAL = `node ${writeBin} ${message}`;

fixture = { ...fixtures.editor };
rl = new ReadlineStub();
Expand Down

0 comments on commit b9978e2

Please sign in to comment.