Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
refactor: use execSync for tests (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Apr 5, 2019
1 parent 31a4115 commit dfc0aa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
},
"devDependencies": {
"chai": "^4.2.0",
"execa": "^1.0.0",
"mocha": "^6.0.0"
}
}
20 changes: 11 additions & 9 deletions samples/test/samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,34 @@
'use strict';

const {assert} = require('chai');
const execa = require('execa');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

describe('quickstart', () => {
it('should return a list of images', async () => {
const {stdout} = await execa('node', ['quickstart.js']);
it('should return a list of images', () => {
const stdout = execSync('node quickstart.js');
assert.match(stdout, /^{/);
});
});

describe('from project', () => {
it('should return an image', async () => {
const {stdout} = await execa('node', ['fromProject.js']);
it('should return an image', () => {
const stdout = execSync('node fromProject.js');
assert.match(stdout, /^{/);
});
});

describe('latestSpecificOS', () => {
it('should return an image', async () => {
const {stdout} = await execa('node', ['latestSpecificOS.js']);
it('should return an image', () => {
const stdout = execSync('node latestSpecificOS.js');
assert.match(stdout, /^{/);
});
});

describe('specificOS', () => {
it('should return an image', async () => {
const {stdout} = await execa('node', ['specificOS.js']);
it('should return an image', () => {
const stdout = execSync('node specificOS.js');
assert.match(stdout, /^{/);
});
});

0 comments on commit dfc0aa5

Please sign in to comment.