Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/specs/json-fg/rulesets/circular-arc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ describe('/req/circular-arcs/metadata', () => {
expect(violations).toHaveLength(0);
});

test('Succeeds when a feature collection has a place-less feature and no circular arc geometry (regression: absent "place" must not trip the rule)', async () => {
const { place: _omitted, ...placelessFeature } = featureCollectionDoc.features[0];

const violations = await spectral.run({
...featureCollectionDoc,
features: [placelessFeature, ...featureCollectionDoc.features.slice(1)],
});

expect(violations.filter(v => v.code === '/req/circular-arcs/metadata')).toHaveLength(0);
});

test('Fails when a feature place has type "CircularString" and does not include the Circular Arcs conformance class', async () => {
const violations = await spectral.run({
...featureDoc,
Expand Down
7 changes: 6 additions & 1 deletion src/specs/json-fg/rulesets/circular-arcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ const circularArcs: RulesetDefinition = {
if: {
anyOf: [
{
required: ['type'],
required: ['type', 'place'],
properties: {
type: {
const: 'Feature',
},
place: {
type: 'object',
required: ['type'],
properties: {
type: {
enum: CIRCULAR_ARC_TYPES,
Expand All @@ -52,8 +54,11 @@ const circularArcs: RulesetDefinition = {
},
features: {
contains: {
required: ['place'],
properties: {
place: {
type: 'object',
required: ['type'],
properties: {
type: {
enum: CIRCULAR_ARC_TYPES,
Expand Down
11 changes: 11 additions & 0 deletions src/specs/json-fg/rulesets/polyhedra.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ describe('/req/polyhedra/metadata', () => {
expect(violations).toHaveLength(0);
});

test('Succeeds when a feature collection has a place-less feature and no polyhedron geometry (regression: absent "place" must not trip the rule)', async () => {
const { place: _omitted, ...placelessFeature } = featureCollectionDoc.features[0];

const violations = await spectral.run({
...featureCollectionDoc,
features: [placelessFeature, ...featureCollectionDoc.features.slice(1)],
});

expect(violations.filter(v => v.code === '/req/polyhedra/metadata')).toHaveLength(0);
});

test('Fails when a feature place has type "Polyhedron" and does not include the Polyhedra conformance class', async () => {
const violations = await spectral.run({
...featureDoc,
Expand Down
7 changes: 6 additions & 1 deletion src/specs/json-fg/rulesets/polyhedra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ const polyhedra: RulesetDefinition = {
if: {
anyOf: [
{
required: ['type'],
required: ['type', 'place'],
properties: {
type: {
const: 'Feature',
},
place: {
type: 'object',
required: ['type'],
properties: {
type: {
enum: POLYHEDRON_TYPES,
Expand All @@ -47,8 +49,11 @@ const polyhedra: RulesetDefinition = {
},
features: {
contains: {
required: ['place'],
properties: {
place: {
type: 'object',
required: ['type'],
properties: {
type: {
enum: POLYHEDRON_TYPES,
Expand Down
11 changes: 11 additions & 0 deletions src/specs/json-fg/rulesets/prisms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ describe('/req/prisms/metadata', () => {
expect(violations).toHaveLength(0);
});

test('Succeeds when a feature collection has a place-less feature and no prism geometry (regression: absent "place" must not trip the rule)', async () => {
const { place: _omitted, ...placelessFeature } = featureCollectionDoc.features[0];

const violations = await spectral.run({
...featureCollectionDoc,
features: [placelessFeature, ...featureCollectionDoc.features.slice(1)],
});

expect(violations.filter(v => v.code === '/req/prisms/metadata')).toHaveLength(0);
});

test('Fails when a feature place has type "Prism" and does not include the Prisms conformance class', async () => {
const violations = await spectral.run({
...featureDoc,
Expand Down
7 changes: 6 additions & 1 deletion src/specs/json-fg/rulesets/prisms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ const prisms: RulesetDefinition = {
if: {
anyOf: [
{
required: ['type'],
required: ['type', 'place'],
properties: {
type: {
const: 'Feature',
},
place: {
type: 'object',
required: ['type'],
properties: {
type: {
enum: PRISM_TYPES,
Expand All @@ -48,8 +50,11 @@ const prisms: RulesetDefinition = {
},
features: {
contains: {
required: ['place'],
properties: {
place: {
type: 'object',
required: ['type'],
properties: {
type: {
enum: PRISM_TYPES,
Expand Down