From dd6a49984104788cf032ef02ba1ac7e8bd160efc Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Tue, 16 Apr 2019 11:33:02 +0200 Subject: [PATCH] Adjusted test suites to new fatal grouping --- test/general.test.js | 63 +++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/test/general.test.js b/test/general.test.js index 5198b3dc5..237f614e5 100644 --- a/test/general.test.js +++ b/test/general.test.js @@ -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); @@ -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(); @@ -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(); @@ -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 here.`); + 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 here.`); }); }); });