Skip to content

Commit 12f8a9a

Browse files
committed
test: issue #82
1 parent 7bddb97 commit 12f8a9a

File tree

5 files changed

+48
-3
lines changed

5 files changed

+48
-3
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ insert_final_newline = true
1616
trim_trailing_whitespace = false
1717
indent_size = 2
1818

19-
[{package.json,bower.json}]
19+
[package.json]
2020
indent_style = space
2121
indent_size = 2

.prettierrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"printWidth": 120,
3-
"tabWidth": 4,
43
"singleQuote": false,
54
"bracketSpacing": true,
65
"trailingComma": "none"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"test:6:ci": "DISABLE_LOG=true mocha -R json 'src/tests/spec/draft06.spec.ts' > test-result-spec6.json; exit 0",
3030
"test:7": "mocha 'src/tests/spec/draft07.spec.ts'",
3131
"test:7:ci": "DISABLE_LOG=true mocha -R json 'src/tests/spec/draft07.spec.ts' > test-result-spec7.json; exit 0",
32-
"test:inspect": "yarn test:2019 --inspect-brk",
32+
"test:inspect": "yarn test:unit --inspect-brk",
3333
"test:spec": "mocha 'src/tests/spec/*.spec.ts'",
3434
"test:unit": "mocha 'src/**/*.test.ts'",
3535
"test:unit:ci": "DISABLE_LOG=true mocha -R json 'src/**/*.test.ts' -R json > test-result-unit.json; exit 0"

src/tests/issues/issue82.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { strict as assert } from "assert";
2+
import { compileSchema } from "../../compileSchema";
3+
4+
// @todo investigate different requirements on joining url and id
5+
// here json-schemer://schema + stock-assembly is joined to json-schemer://stock-assembly
6+
// in joinId: const trailingFragments = /\/\/*$/; will fix this issue but fail spec tests
7+
describe.skip("issue#82", () => {
8+
it("should return validation errors for number", () => {
9+
const schema = compileSchema({
10+
$schema: "https://json-schema.org/draft/2020-12/schema",
11+
type: "object",
12+
required: ["stock-assembly"],
13+
properties: {
14+
"stock-assembly": {
15+
$ref: "stock-assembly"
16+
}
17+
},
18+
$id: "json-schemer://schema", // this works only if a trailing slash
19+
$defs: {
20+
"json-schemer://schema/stock-assembly": {
21+
$schema: "http://json-schema.org/draft-07/schema#",
22+
type: "object",
23+
properties: {
24+
$filter: {
25+
type: "string",
26+
title: "Фильтр"
27+
}
28+
},
29+
$id: "json-schemer://schema/stock-assembly"
30+
}
31+
}
32+
});
33+
34+
const { valid, errors } = schema.validate({
35+
"stock-assembly": 1
36+
});
37+
38+
assert.equal(valid, false);
39+
});
40+
});

src/utils/joinId.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ describe("joinId", () => {
5050
assert.equal(url, "https://localhost.com/root#bar");
5151
});
5252

53+
it.skip("should append id without fragment to url", () => {
54+
const url = joinId("https://localhost.com/root", "bar");
55+
56+
assert.equal(url, "https://localhost.com/root/bar");
57+
});
58+
5359
it("should append id to url/", () => {
5460
const url = joinId("https://localhost.com/root/", "#bar");
5561

0 commit comments

Comments
 (0)