Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
test: add extra test asserting that unknown keys are allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored and digitalsadhu committed Jan 31, 2018
1 parent e90832b commit 9113289
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/__snapshots__/reader.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -58949,9 +58949,9 @@ exports[`should dedupe 1`] = `
"
`;

exports[`should error if any feed content keys are missing 1`] = `"Expected at least 1 feed (array) to have more than one entry (object)."`;
exports[`should error if any feed content keys are missing 1`] = `"Expected every item in argument 'feeds' (array) to be a valid feed (object).: child \\"id\\" fails because [\\"id\\" is required]"`;

exports[`should error if any feed content keys are missing 2`] = `"Expected at least 1 feed (array) to have more than one entry (object)."`;
exports[`should error if any feed content keys are missing 2`] = `"Expected every item in argument 'feeds' (array) to be a valid feed (object).: child \\"source\\" fails because [\\"source\\" is required]"`;

exports[`should error if feed content does not contain at least 1 entrypoint 1`] = `"Expected at least 1 feed (array) to have more than one entry (object)."`;

Expand Down
21 changes: 19 additions & 2 deletions test/reader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,29 @@ test('should error if feed content is non object', async () => {
});

test('should error if any feed content keys are missing', async () => {
await expect(bundleJS([{}])).rejects.toThrowErrorMatchingSnapshot();
await expect(bundleJS([[{}]])).rejects.toThrowErrorMatchingSnapshot();
await expect(
bundleJS([{ file: 'asd', deps: {}, id: 'a', entry: true }])
bundleJS([[{ file: 'asd', deps: {}, id: 'a', entry: true }]])
).rejects.toThrowErrorMatchingSnapshot();
});

test('should not error if any feed contains extra content keys', async () => {
await expect(
bundleJS([
[
{
file: 'asd',
deps: {},
id: 'a',
entry: true,
source: '"use strict";',
somethingWeird: true,
},
],
])
).resolves.toBeDefined();
});

test('should error if feed content does not contain at least 1 entrypoint', async () => {
await expect(
bundleJS([
Expand Down

0 comments on commit 9113289

Please sign in to comment.