From 2f1020a044a871add4bd3a3c4032fbff1a23272e Mon Sep 17 00:00:00 2001 From: DaanV2 Date: Wed, 18 Aug 2021 20:52:07 +0200 Subject: [PATCH] Added schemas count check --- test/src/files/correct.test.ts | 13 ++++++++++++- test/src/files/incorrect.test.ts | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/test/src/files/correct.test.ts b/test/src/files/correct.test.ts index df57f85c..269e12ec 100644 --- a/test/src/files/correct.test.ts +++ b/test/src/files/correct.test.ts @@ -16,6 +16,17 @@ describe("test correct files", () => { it(testfolder, () => { let result = validator.ValidateFile(file); + let schemas = validator.ls.getMatchingSchemas(result.doc, result.jdoc); + + schemas.then( + (success) => { + expect(success.length, "Expected schemas to be returned").to.greaterThan(0); + }, + (fail) => { + expect.fail("failed on retrieving schemas"); + } + ); + result.promise.then( (succes) => { expect(succes.length, "Expected no errors got: " + JSON.stringify(succes)).to.equal(0); @@ -25,7 +36,7 @@ describe("test correct files", () => { } ); - return result.promise; + return Promise.all([result.promise, schemas]); }); } }); diff --git a/test/src/files/incorrect.test.ts b/test/src/files/incorrect.test.ts index 103cef7e..d559aebf 100644 --- a/test/src/files/incorrect.test.ts +++ b/test/src/files/incorrect.test.ts @@ -16,6 +16,17 @@ describe("test incorrect files", () => { it(testfolder, () => { let result = validator.ValidateFile(file); + let schemas = validator.ls.getMatchingSchemas(result.doc, result.jdoc); + + schemas.then( + (success) => { + expect(success.length, "Expected schemas to be returned").to.greaterThan(0); + }, + (fail) => { + expect.fail("failed on retrieving schemas"); + } + ); + result.promise.then( (succes) => { expect(succes.length, "Expected errors! but had none").to.greaterThan(0); @@ -25,7 +36,7 @@ describe("test incorrect files", () => { } ); - return result.promise; + return Promise.all([schemas, result]); }); } });