Skip to content

Commit

Permalink
Add test for CLI execution #44
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Dec 13, 2021
1 parent e54e42e commit 93a02de
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const app = require('../index');
const { version } = require('../package.json');
const fs = require('fs/promises');
const { exec } = require("child_process");

let consoleErrSpy, consoleWarnSpy, consoleInfSpy, consoleLogSpy, mockExit;
const initString = `STAC Node Validator v${version}`;
Expand All @@ -20,6 +21,15 @@ beforeEach(() => {
consoleErrSpy = jest.spyOn(console, 'error').mockImplementation();
});

it('Should be executable via shell', done => {
exec("stac-node-validator --version", (error, stdout, stderr) => {
expect(error).toBe(null);
expect(stderr).toBe("");
expect(stdout).toContain(version);
done();
});
});

it('Should print init string', async () => {
await app();

Expand Down

0 comments on commit 93a02de

Please sign in to comment.