Skip to content

Commit

Permalink
More test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ddamato committed Jun 17, 2020
1 parent a50e36c commit b8cec3e
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 6 deletions.
1 change: 1 addition & 0 deletions bin/create-symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const args = minimist(process.argv.slice(2), {
});

createSymbols(args.input).then(async (symbols) => {
console.log(`processing: ${args.input}`);
if (!symbols || !Object.keys(symbols).length) {
throw new Error(`No svg files found in input directory "${args.input}"`);
}
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
"build:docs": "npm run build && npm run copy:dist && node ./bin/build-docs.js",
"prepare": "npm run build",
"prepare:assets": "node ./bin/create-symbols.js -i docs/svg -o docs/assets -t esm",
"test": "nyc mocha test/**/*.test.js -r esm",
"test": "npm run test:src",
"test:src": "nyc mocha test/src/*.test.js -r esm",
"test:esm": "nyc mocha test/dist/esm.test.js -r esm",
"test:umd": "nyc mocha test/dist/umd.test.js",
"test:bin": "nyc mocha test/bin/*.test.js",
"version": "auto-changelog -p && git add CHANGELOG.md"
},
"bin": {
Expand Down
20 changes: 20 additions & 0 deletions test/bin/create-symbols.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const path = require('path');
const { exec } = require('child_process');
const { expect } = require('chai');
const createSymbolsProcess = path.resolve(__dirname, '..', '..', 'bin', 'create-symbols.js');

describe('create-symbols.js', function (done) {
after(function () {
exec('rm -rf test/bin/output');
});

it('should execute process', function (done) {
exec(`${createSymbolsProcess} -i test/bin/fixtures -o test/bin/output`, (err, stdout, stderr) => {
console.log(err);
console.log(stdout);
console.log(stderr);
done();
});

});
});
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jsdomGlobal from 'jsdom-global';
import { expect } from 'chai';

import consolidateSheet from '../src/consolidateSheet.js';
import consolidateSheet from '../../src/consolidateSheet.js';

jsdomGlobal()();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';
import jsdomGlobal from 'jsdom-global';
import { expect } from 'chai';

import createSymbols from '../src/createSymbols.js';
import createSymbols from '../../src/createSymbols.js';

jsdomGlobal()();

Expand Down
3 changes: 3 additions & 0 deletions test/src/fixtures/x.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/getAssets.test.js → test/src/getAssets.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import getAssets from '../src/getAssets.js';
import getAssets from '../../src/getAssets.js';

describe('getAssets', function () {
it('should be a function', function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jsdomGlobal from 'jsdom-global';
import { expect } from 'chai';

import { injectionStyle, injectionAttrs, injectionFn } from '../src/injectionManager.js';
import { injectionStyle, injectionAttrs, injectionFn } from '../../src/injectionManager.js';

jsdomGlobal()();

Expand Down
2 changes: 1 addition & 1 deletion test/savager.test.js → test/src/savager.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jsdomGlobal from 'jsdom-global';
import { expect } from 'chai';

import Savager from '../src/savager.js';
import Savager from '../../src/savager.js';

jsdomGlobal()();

Expand Down

0 comments on commit b8cec3e

Please sign in to comment.