Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Correct remaining tests for dropping the module component type
Browse files Browse the repository at this point in the history
  • Loading branch information
notlee committed Apr 29, 2021
1 parent 6d021dc commit 13691bd
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions test/unit/tasks/verify-origami-json.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ describe('verify-origami-json', function () {
});
});

it('should fail if origamiType property is no or "service" or "imageset"', function () {
it('should fail if origamiType property is not supported', function () {
const origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8'));
origamiJSON.origamiType = '';
origamiJSON.origamiType = 'module';
fs.writeFileSync('origami.json', JSON.stringify(origamiJSON), 'utf8');

return verifyOrigamiJson().task()
Expand Down Expand Up @@ -236,9 +236,9 @@ describe('verify-origami-json', function () {
proclaim.notCalled(console.log);
});

it('should pass if origamiType property i', async function () {
it('should pass if origamiType property is "component', async function () {
const origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8'));
origamiJSON.origamiType = 'module';
origamiJSON.origamiType = 'component';
fs.writeFileSync('origami.json', JSON.stringify(origamiJSON), 'utf8');

await verifyOrigamiJson().task();
Expand All @@ -254,6 +254,27 @@ describe('verify-origami-json', function () {
proclaim.notCalled(console.log);
});

it('should fail if origamiType property is "module"', function () {
const origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8'));
delete origamiJSON.origamiVersion;
fs.writeFileSync('origami.json', JSON.stringify(origamiJSON), 'utf8');

return verifyOrigamiJson().task()
.catch(function (verifiedOrigamiJson) {
proclaim.equal(
verifiedOrigamiJson.message,
'Failed linting:\n\n' +
'The origamiVersion property needs to be set to "2.0" or higher, this version of Origami Build tools only supports v2 of the Origami component specification.\n\n' +
'The origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/'
);
proclaim.calledOnce(console.log);
proclaim.calledWithExactly(
console.log,
`::error file=origami.json,line=1,col=1::Failed linting:%0A%0AThe origamiVersion property needs to be set to "2.0" or higher, this version of Origami Build tools only supports v2 of the Origami component specification.%0A%0AThe origami.json file does not conform to the specification at http://origami.ft.com/docs/syntax/origamijson/`
);
});
});

it('should fail if missing origamiVersion property', function () {
const origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8'));
delete origamiJSON.origamiVersion;
Expand Down Expand Up @@ -527,7 +548,7 @@ describe('verify-origami-json', function () {

beforeEach(() => {
origamiJSON = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'origami.json'), 'utf-8'));
origamiJSON.origamiType = 'module';
origamiJSON.origamiType = 'component';
});

it('should fail when a demo does not have a title property', function () {
Expand Down

0 comments on commit 13691bd

Please sign in to comment.