Skip to content

Commit

Permalink
Added YAML multi-document test
Browse files Browse the repository at this point in the history
  • Loading branch information
Abrifq committed Oct 16, 2023
1 parent 8806cbc commit 81083c1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,18 @@ describe("CLI", function () {
});
});
it("should return 1 on multi-document as schema", function () {
//TBA: Add a multi schema document as test file.
//TODO: Add a multi schema document as test file.
return cli({
patterns: ["./testfiles/files/valid.json"],
schema: "./testfiles/schemas/schema.multi-doc.yaml",
}).then((result) => {
assert.equal(result, 1);
assert(
logContainsError(
"expected a single document in the stream, but found more",
),
);
});
});
});

Expand Down
18 changes: 18 additions & 0 deletions testfiles/schemas/schema.multi-doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
$schema: http://json-schema.org/draft-07/schema#
type: object
properties:
num:
type: number
required:
- num
additionalProperties: false
...
---
$schema: http://json-schema.org/draft-07/schema#
type: object
properties:
num:
type: number
required:
- num
additionalProperties: false

0 comments on commit 81083c1

Please sign in to comment.