Skip to content

Commit

Permalink
fix bin test mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Jan 21, 2024
1 parent ac834a8 commit 50b8b12
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/unit/bin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function createMocks() {
on: mock.fn((method, func) => {
mocks.stdin[method] = func;
}),
resume: mock.fn
resume: mock.fn()
},
exit: mock.fn((code) => { mocks.code = code; })
}
Expand All @@ -44,7 +44,7 @@ function createMocks() {
function testInput({ args = [], stdin = '', stdinError = '', stdout = '', stderr = '', code = 0 } = {}) {
return async() => {
const mocks = createMocks();
mocks.process.argv = args;
mocks.process.argv = ['node', 'marked', ...args];
const mainPromise = main(mocks.process);
if (typeof mocks.stdin.end === 'function') {
if (stdin) {
Expand All @@ -67,7 +67,7 @@ function fixturePath(filePath) {
return resolve(__dirname, './fixtures', filePath);
}

describe('bin/marked', () => {
describe.only('bin/marked', () => {
describe('string', () => {
it('-s', testInput({
args: ['-s', '# test'],
Expand Down Expand Up @@ -98,8 +98,8 @@ describe('bin/marked', () => {
}));
});

describe('input', () => {
it('input file not found', testInput({
describe.only('input', () => {
it.only('input file not found', testInput({
args: [fixturePath('does-not-exist.md')],
stderr: `Cannot load input file '${fixturePath('does-not-exist.md')}'`,
code: 1
Expand Down

0 comments on commit 50b8b12

Please sign in to comment.