Skip to content

Commit

Permalink
Add more tests for StatsSerializeStream
Browse files Browse the repository at this point in the history
  • Loading branch information
th0r committed Nov 6, 2020
1 parent 6ad1857 commit 058590a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"eslint-config-th0r-react": "2.0.1",
"eslint-plugin-react": "7.21.5",
"exports-loader": "1.1.1",
"globby": "11.0.1",
"gulp": "4.0.2",
"gulp-babel": "8.0.0",
"mobx": "5.15.7",
Expand Down
12 changes: 12 additions & 0 deletions test/statsUtils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const path = require('path');
const {readFileSync} = require('fs');
const globby = require('globby');

const {StatsSerializeStream} = require('../lib/statsUtils');

describe('StatsSerializeStream', () => {
Expand Down Expand Up @@ -46,6 +50,14 @@ describe('StatsSerializeStream', () => {
}
});
});

globby.sync('stats/**/*.json', {cwd: __dirname}).forEach(filepath => {
it(`should properly stringify JSON from "${filepath}"`, function () {
const content = readFileSync(path.resolve(__dirname, filepath), 'utf8');
const json = JSON.parse(content);
expectProperJson(json);
});
});
});

async function expectProperJson(json) {
Expand Down

0 comments on commit 058590a

Please sign in to comment.