Skip to content

Commit

Permalink
Adjusted test suites to new fatal grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
naz committed Apr 16, 2019
1 parent d08a898 commit dd6a499
Showing 1 changed file with 30 additions and 33 deletions.
63 changes: 30 additions & 33 deletions test/general.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,27 +403,11 @@ describe('format', function () {
checker(themePath('005-compile/invalid')).then((theme) => {
theme = format(theme);

theme.results.error.length.should.eql(16);
theme.results.error[0].fatal.should.eql(true);
// theme.results.error[1].fatal.should.eql(true);
// theme.results.error[2].fatal.should.eql(true);
theme.results.error[3].fatal.should.eql(false);
// theme.results.error[10].fatal.should.eql(false);
theme.results.error.length.should.eql(15);
theme.results.fatal.length.should.eql(1);

done();
}).catch(done);
});

it('assert sorting', function (done) {
checker(themePath('is-empty')).then((theme) => {
theme = format(theme);

theme.results.error[0].fatal.should.eql(true);
theme.results.error[1].fatal.should.eql(true);
theme.results.error[4].fatal.should.eql(false);
theme.results.error[10].fatal.should.eql(false);
theme.results.error[11].fatal.should.eql(false);
theme.results.error[12].fatal.should.eql(false);
theme.results.error[0].fatal.should.eql(false);
theme.results.fatal[0].fatal.should.eql(true);

done();
}).catch(done);
Expand All @@ -441,13 +425,16 @@ describe('format', function () {
theme.results.warning.all.length.should.eql(3);
theme.results.warning.byFiles['default.hbs'].length.should.eql(2);

theme.results.error.all.length.should.eql(16);
theme.results.error.all.length.should.eql(15);
theme.results.fatal.all.length.should.eql(1);

// 1 rule has file references
theme.results.error.byFiles['author.hbs'].length.should.eql(1);
theme.results.error.byFiles['page.hbs'].length.should.eql(1);
theme.results.error.byFiles['post.hbs'].length.should.eql(1);
theme.results.error.byFiles['index.hbs'].length.should.eql(1);
theme.results.fatal.byFiles['author.hbs'].length.should.eql(1);
theme.results.fatal.byFiles['page.hbs'].length.should.eql(1);
theme.results.fatal.byFiles['post.hbs'].length.should.eql(1);
theme.results.fatal.byFiles['index.hbs'].length.should.eql(1);

theme.results.error.byFiles['default.hbs'].length.should.eql(1);
theme.results.error.byFiles['package.json'].length.should.eql(9);

done();
Expand All @@ -463,14 +450,24 @@ describe('format', function () {
theme.results.recommendation.all.length.should.eql(2);
theme.results.recommendation.byFiles['package.json'].length.should.eql(1);

theme.results.error.all.length.should.eql(88);
theme.results.fatal.all.length.should.eql(23);
theme.results.error.all.length.should.eql(65);
theme.results.warning.all.length.should.eql(2);

theme.results.error.byFiles['assets/my.css'].length.should.eql(3);
theme.results.error.byFiles['default.hbs'].length.should.eql(17);
theme.results.error.byFiles['post.hbs'].length.should.eql(54);
theme.results.error.byFiles['partials/mypartial.hbs'].length.should.eql(5);
theme.results.error.byFiles['index.hbs'].length.should.eql(9);

theme.results.error.byFiles['default.hbs'].length.should.eql(13);
theme.results.fatal.byFiles['default.hbs'].length.should.eql(4);

theme.results.error.byFiles['post.hbs'].length.should.eql(36);
theme.results.fatal.byFiles['post.hbs'].length.should.eql(18);

theme.results.error.byFiles['partials/mypartial.hbs'].length.should.eql(2);
theme.results.fatal.byFiles['partials/mypartial.hbs'].length.should.eql(3);

theme.results.error.byFiles['index.hbs'].length.should.eql(2);
theme.results.fatal.byFiles['index.hbs'].length.should.eql(7);

theme.results.error.byFiles['error.hbs'].length.should.eql(1);

done();
Expand All @@ -481,10 +478,10 @@ describe('format', function () {
return checker(themePath('001-deprecations/latest/invalid_all')).then((theme) => {
theme = format(theme, {format: 'cli'});

theme.results.error[0].rule.should.equal('Replace \u001b[36m{{pageUrl}}\u001b[39m with \u001b[36m{{page_url}}\u001b[39m');
theme.results.fatal[0].rule.should.equal('Replace \u001b[36m{{pageUrl}}\u001b[39m with \u001b[36m{{page_url}}\u001b[39m');

theme.results.error[0].details.should.startWith(`The helper \u001b[36m{{pageUrl}}\u001b[39m was replaced with \u001b[36m{{page_url}}\u001b[39m.\n\n`);
theme.results.error[0].details.should.endWith(`Find more information about the \u001b[36m{{page_url}}\u001b[39m helper <a href="https://themes.ghost.org/docs/page_url" target=_blank>here</a>.`);
theme.results.fatal[0].details.should.startWith(`The helper \u001b[36m{{pageUrl}}\u001b[39m was replaced with \u001b[36m{{page_url}}\u001b[39m.\n\n`);
theme.results.fatal[0].details.should.endWith(`Find more information about the \u001b[36m{{page_url}}\u001b[39m helper <a href="https://themes.ghost.org/docs/page_url" target=_blank>here</a>.`);
});
});
});

0 comments on commit dd6a499

Please sign in to comment.