Skip to content

Commit dd6a499

Browse files
committed
Adjusted test suites to new fatal grouping
1 parent d08a898 commit dd6a499

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

test/general.test.js

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -403,27 +403,11 @@ describe('format', function () {
403403
checker(themePath('005-compile/invalid')).then((theme) => {
404404
theme = format(theme);
405405

406-
theme.results.error.length.should.eql(16);
407-
theme.results.error[0].fatal.should.eql(true);
408-
// theme.results.error[1].fatal.should.eql(true);
409-
// theme.results.error[2].fatal.should.eql(true);
410-
theme.results.error[3].fatal.should.eql(false);
411-
// theme.results.error[10].fatal.should.eql(false);
406+
theme.results.error.length.should.eql(15);
407+
theme.results.fatal.length.should.eql(1);
412408

413-
done();
414-
}).catch(done);
415-
});
416-
417-
it('assert sorting', function (done) {
418-
checker(themePath('is-empty')).then((theme) => {
419-
theme = format(theme);
420-
421-
theme.results.error[0].fatal.should.eql(true);
422-
theme.results.error[1].fatal.should.eql(true);
423-
theme.results.error[4].fatal.should.eql(false);
424-
theme.results.error[10].fatal.should.eql(false);
425-
theme.results.error[11].fatal.should.eql(false);
426-
theme.results.error[12].fatal.should.eql(false);
409+
theme.results.error[0].fatal.should.eql(false);
410+
theme.results.fatal[0].fatal.should.eql(true);
427411

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

444-
theme.results.error.all.length.should.eql(16);
428+
theme.results.error.all.length.should.eql(15);
429+
theme.results.fatal.all.length.should.eql(1);
445430

446431
// 1 rule has file references
447-
theme.results.error.byFiles['author.hbs'].length.should.eql(1);
448-
theme.results.error.byFiles['page.hbs'].length.should.eql(1);
449-
theme.results.error.byFiles['post.hbs'].length.should.eql(1);
450-
theme.results.error.byFiles['index.hbs'].length.should.eql(1);
432+
theme.results.fatal.byFiles['author.hbs'].length.should.eql(1);
433+
theme.results.fatal.byFiles['page.hbs'].length.should.eql(1);
434+
theme.results.fatal.byFiles['post.hbs'].length.should.eql(1);
435+
theme.results.fatal.byFiles['index.hbs'].length.should.eql(1);
436+
437+
theme.results.error.byFiles['default.hbs'].length.should.eql(1);
451438
theme.results.error.byFiles['package.json'].length.should.eql(9);
452439

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

466-
theme.results.error.all.length.should.eql(88);
453+
theme.results.fatal.all.length.should.eql(23);
454+
theme.results.error.all.length.should.eql(65);
467455
theme.results.warning.all.length.should.eql(2);
468456

469457
theme.results.error.byFiles['assets/my.css'].length.should.eql(3);
470-
theme.results.error.byFiles['default.hbs'].length.should.eql(17);
471-
theme.results.error.byFiles['post.hbs'].length.should.eql(54);
472-
theme.results.error.byFiles['partials/mypartial.hbs'].length.should.eql(5);
473-
theme.results.error.byFiles['index.hbs'].length.should.eql(9);
458+
459+
theme.results.error.byFiles['default.hbs'].length.should.eql(13);
460+
theme.results.fatal.byFiles['default.hbs'].length.should.eql(4);
461+
462+
theme.results.error.byFiles['post.hbs'].length.should.eql(36);
463+
theme.results.fatal.byFiles['post.hbs'].length.should.eql(18);
464+
465+
theme.results.error.byFiles['partials/mypartial.hbs'].length.should.eql(2);
466+
theme.results.fatal.byFiles['partials/mypartial.hbs'].length.should.eql(3);
467+
468+
theme.results.error.byFiles['index.hbs'].length.should.eql(2);
469+
theme.results.fatal.byFiles['index.hbs'].length.should.eql(7);
470+
474471
theme.results.error.byFiles['error.hbs'].length.should.eql(1);
475472

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

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

486-
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`);
487-
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>.`);
483+
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`);
484+
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>.`);
488485
});
489486
});
490487
});

0 commit comments

Comments
 (0)