Skip to content

Commit

Permalink
test(markdown): add test for failing self-references
Browse files Browse the repository at this point in the history
test for #392
  • Loading branch information
trieloff committed Feb 14, 2022
1 parent 72b9ffd commit 7007f8b
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
56 changes: 56 additions & 0 deletions test/fixtures/selfreference/selfreference.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"ItemLink": {
"properties": {
"allowedSuccessors": {
"items": {
"type": "string"
},
"type": "array"
},
"class": {
"type": "string"
}
},
"type": "object"
},
"ItemLinkOptions": {
"properties": {
"allowedLinks": {
"items": {
"$ref": "#/definitions/ItemLink"
},
"type": "array"
},
"maxIncoming": {
"type": "number"
},
"maxOutgoing": {
"type": "number"
}
},
"type": "object"
}
},
"properties": {
"id": {
"type": "string"
},
"items": {
"items": {
"anyOf": [
{
"$ref": "#/definitions/ItemLink"
}
]
},
"type": "array"
},

"version": {
"type": "string"
}
},
"type": "object"
}
16 changes: 16 additions & 0 deletions test/markdownBuilder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,3 +439,19 @@ describe('Testing Markdown Builder: Skip properties', () => {
.doesNotContain('- defined in: [Complete JSON Schema]');
});
});

describe('Testing Markdown Builder: Self-References', () => {
let schemas;

before(async () => {
schemas = await traverseSchemas('selfreference');
});

it('ItemLink property exist', () => {
const builder = build({});
const results = builder(schemas);

assertMarkdown(results.complete)
.contains('ItemLink');
});
});

0 comments on commit 7007f8b

Please sign in to comment.