Skip to content

Commit

Permalink
feat: Make summary updated and created optional (#187)
Browse files Browse the repository at this point in the history
See <#143>.
  • Loading branch information
l0b0 authored Nov 24, 2021
1 parent 497c182 commit 7068e7d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion extensions/linz/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,6 @@
},
"summaries": {
"type": "object",
"required": ["created", "updated"],
"properties": {
"created": {
"type": "object",
Expand Down
21 changes: 14 additions & 7 deletions extensions/linz/tests/linz_collection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ o.spec('LINZ collection', () => {
).equals(true)(JSON.stringify(validate.errors));
});

o("Summaries with no 'created' property should fail validation", async () => {
o("Summaries with no 'created' property should not fail validation", async () => {
// given
const example = JSON.parse(await fs.readFile(examplePath));
delete example['summaries']['created'];
Expand All @@ -94,12 +94,19 @@ o.spec('LINZ collection', () => {
let valid = validate(example);

// then
o(valid).equals(false);
o(
validate.errors.some(
(error) => error.instancePath === '/summaries' && error.message === "must have required property 'created'",
),
).equals(true)(JSON.stringify(validate.errors));
o(valid).equals(true);
});

o("Summaries with no 'updated' property should not fail validation", async () => {
// given
const example = JSON.parse(await fs.readFile(examplePath));
delete example['summaries']['updated'];

// when
let valid = validate(example);

// then
o(valid).equals(true);
});

o("Example with no 'linz:geospatial_type' property should fail validation", async () => {
Expand Down

0 comments on commit 7068e7d

Please sign in to comment.