Fixing/item descriptors (#122)
* Adding correct samples, but know to fail * Renamed * Updated validator
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { expect } from "chai";
|
||||
import { Github } from "../Github";
|
||||
import { Schema } from "../SchemaTester";
|
||||
import { Files } from "../Utillity";
|
||||
|
||||
@@ -14,34 +15,29 @@ describe("test correct files", function () {
|
||||
.forEach((file) => {
|
||||
const testfolder = file.replace(folder + "/", "");
|
||||
|
||||
describe(testfolder, function () {
|
||||
it(`File should have a schema & validate correctly: ${testfolder}`, async function () {
|
||||
const result = validator.ValidateFile(file);
|
||||
const schemas = validator.ls.getMatchingSchemas(result.doc, result.jdoc);
|
||||
|
||||
it("validation", function () {
|
||||
result.promise.then(
|
||||
(succes) => {
|
||||
expect(succes.length, "Expected no errors got: " + succes.length).to.equal(0);
|
||||
succes.forEach((item) => console.log(item.message));
|
||||
},
|
||||
(fail) => {
|
||||
expect.fail("Failed to validate");
|
||||
}
|
||||
);
|
||||
|
||||
return result.promise;
|
||||
});
|
||||
|
||||
it("schemas", function () {
|
||||
return 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: " + succes.length).to.equal(0);
|
||||
succes.forEach((item) => console.log(item.message));
|
||||
},
|
||||
(fail) => {
|
||||
Github.createError("Failed on validating", { file: file });
|
||||
expect.fail("Failed to validate");
|
||||
}
|
||||
);
|
||||
schemas.then(
|
||||
(success) => {
|
||||
expect(success.length, "Expected schemas to be returned").to.greaterThan(0);
|
||||
},
|
||||
(fail) => {
|
||||
Github.createError("Failed on retrieving schemas", { file: file });
|
||||
expect.fail("failed on retrieving schemas");
|
||||
}
|
||||
);
|
||||
|
||||
return Promise.all([result.promise, schemas]);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { expect } from "chai";
|
||||
import { Github } from "../Github";
|
||||
import { Schema } from "../SchemaTester";
|
||||
import { Files } from "../Utillity";
|
||||
|
||||
@@ -14,33 +15,28 @@ describe("test incorrect files", function () {
|
||||
.forEach((file) => {
|
||||
const testfolder = file.replace(folder + "/", "");
|
||||
|
||||
describe(testfolder, function () {
|
||||
it(`File should invalidate & have a schema: ${testfolder}`, async function () {
|
||||
const result = validator.ValidateFile(file);
|
||||
const schemas = validator.ls.getMatchingSchemas(result.doc, result.jdoc);
|
||||
|
||||
it("schemas", function () {
|
||||
return schemas.then(
|
||||
(success) => {
|
||||
expect(success.length, "Expected schemas to be returned").to.greaterThan(0);
|
||||
},
|
||||
(fail) => {
|
||||
expect.fail("failed on retrieving schemas");
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("validation", function () {
|
||||
result.promise.then(
|
||||
(succes) => {
|
||||
expect(succes.length, "Expected errors! but had none").to.greaterThan(0);
|
||||
},
|
||||
(fail) => {
|
||||
expect.fail("Failed to validate");
|
||||
}
|
||||
);
|
||||
|
||||
return result.promise;
|
||||
});
|
||||
result.promise.then(
|
||||
(succes) => {
|
||||
expect(succes.length, "Expected errors! but had none").to.greaterThan(0);
|
||||
},
|
||||
(fail) => {
|
||||
Github.createError("No errors where found", { file: file });
|
||||
expect.fail("Failed to validate");
|
||||
}
|
||||
);
|
||||
schemas.then(
|
||||
(success) => {
|
||||
expect(success.length, "Expected schemas to be returned").to.greaterThan(0);
|
||||
},
|
||||
(fail) => {
|
||||
Github.createError("Found no schema", { file: file });
|
||||
expect.fail("failed on retrieving schemas");
|
||||
}
|
||||
);
|
||||
|
||||
return Promise.all([schemas, result]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user