test: adjust tests

This commit is contained in:
Karl-Philipp Wulfert
2019-01-08 14:46:49 +01:00
parent 7f248eea13
commit 3a15b6cf5b
46 changed files with 201 additions and 140 deletions

View File

@@ -12,11 +12,12 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {validateFiles} from '@openstapps/core-validator';
import {validateFiles, writeReport} from '@openstapps/core-tools/lib/validate';
import {Logger} from '@openstapps/logger';
import {expect} from 'chai';
import {mkdirSync} from 'fs';
import {slow, suite, test, timeout} from 'mocha-typescript';
import {join} from 'path';
import {cwd} from 'process';
import {join, resolve} from 'path';
const logger = new Logger();
@@ -29,6 +30,19 @@ process.on('unhandledRejection', (err) => {
export class ValidateTestFiles {
@test
async validateTestFiles() {
await validateFiles(join(cwd(), 'lib', 'schema'), join(cwd(), 'test', 'resources'), join(cwd(), 'report'));
const errorsPerFile = await validateFiles(resolve('lib', 'schema'), resolve('test', 'resources'));
let unexpected = false;
Object.keys(errorsPerFile).forEach((file) => {
unexpected = unexpected || errorsPerFile[file].some((error) => !error.expected);
});
expect(unexpected).to.be.equal(false);
mkdirSync('report', {
recursive: true,
});
await writeReport(join('report', 'index.html'), errorsPerFile);
}
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "academic event",
"description": "Fortsetzung der Algebra I: Galoistheorie mit Anwendungen, ausgewählte Spezialthemen.",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
@@ -78,5 +78,6 @@
}
}
}
}
},
"schema": "SCAcademicEvent"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "academic event",
"description": "Grundlagen, algebraische Grundbegriffe, Vektorräume, lineare Abbildungen und Gleichungen, Determinanten",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
@@ -67,5 +67,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCAcademicEvent"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "academic event",
"description": "Die Übung hat 2 SWS und wird auf 2 Gruppen verteilt.",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
@@ -94,5 +94,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCAcademicEvent"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"type": "article",
"categories": [
@@ -26,5 +26,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCArticle"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"type": "article",
"categories": [
@@ -28,5 +28,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCArticle"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "book",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "Kundenorientierung durch Quality Function Deployment: Systematisches Entwickeln von Produkten und Dienstleistungen",
@@ -42,5 +42,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCBook"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "book",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "Minimal Book",
@@ -23,5 +23,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCBook"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"geo": {
"point": {
"type": "Point",
@@ -165,5 +165,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCBuilding"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "64bb29ed-21e5-50c7-9d7c-1dc4741001b9",
"type": "catalog",
"level": 1,
@@ -55,5 +55,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCCatalog"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "5a1f4f51-2498-5af1-91cb-c939673cc69c",
"type": "catalog",
"level": 3,
@@ -82,5 +82,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCCatalog"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"academicDegree": "bachelor",
"academicDegreewithField": "Bachelor of Arts",
"academicDegreewithFieldShort": "B.A.",
@@ -36,5 +36,6 @@
"timeMode": "parttime",
"type": "course of studies",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140"
}
},
"schema": "SCCourseOfStudies"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "date series",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "Einführung in die Wirtschaftspolitik",
@@ -50,5 +50,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCDateSeries"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "date series",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "Distributed Algorithms",
@@ -47,5 +47,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCDateSeries"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"dateCreated": "2017-02-07T09:26:35.957Z",
"name": "changed_testuid",
@@ -30,5 +30,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCDiff"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"dateCreated": "2017-03-07T09:26:35.957Z",
"name": "changed_testuid",
@@ -30,5 +30,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCDiff"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "dish",
"name": "Pizza mit Geflügelsalami und Champignons",
"categories": [
@@ -65,5 +65,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCDish"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "dish",
"name": "Sahne-Bärlauchsauce",
"description": "Nudelauswahl",
@@ -64,5 +64,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCDish"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"additives": [
"1 = mit Farbstoff",
"2 = konserviert",
@@ -129,5 +129,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCDish"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "favorite",
"name": "Favorite #1",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
@@ -29,5 +29,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCFavorite"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "MA E:0",
"type": "floor",
@@ -7061,5 +7061,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCFloor"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "H_4",
"type": "floor",
@@ -17178,5 +17178,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCFloor"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "H_5",
"type": "floor",
@@ -3554,5 +3554,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCFloor"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "message",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"image": "icon ion-android-hand stapps-color-red-dark",
@@ -13,5 +13,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCMessage"
}

View File

@@ -1,6 +1,8 @@
{
"validationErrorNames": ["enum"],
"scData": {
"errorNames": [
"enum"
],
"instance": {
"type": "invalid-value-in-schema",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"image": "icon ion-android-hand stapps-color-red-dark",
@@ -11,7 +13,8 @@
],
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
"name": "foo"
}
}
},
"schema": "SCMessage"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": ["additionalProperties"],
"scData": {
"errorNames": ["additionalProperties"],
"instance": {
"type": "message",
"invalid-non-existing-key-in-schema": 1,
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
@@ -14,5 +14,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCMessage"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "organization",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"name": "Technische Universität Berlin",
@@ -8,5 +8,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCOrganization"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "person",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"givenName": "Michael",
@@ -12,5 +12,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCPerson"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "person",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"givenName": "Michael",
@@ -12,5 +12,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCPerson"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "person",
"familyName": "Mustermann",
"givenName": "Erika",
@@ -83,5 +83,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCPerson"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "2e925b84-3c99-5df2-a289-62be7a4ae512",
"name": "Validierer (UB)",
"type": "point of interest",
@@ -108,5 +108,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCPointOfInterest"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "1cf75fa0-86dc-5704-8cb4-bd80cf02e640",
"name": "Drucker 1 (IG)",
"type": "point of interest",
@@ -296,5 +296,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCPointOfInterest"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"geo": {
"point": {
"type": "Point",
@@ -30,5 +30,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCRoom"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"geo": {
"point": {
"type": "Point",
@@ -24,5 +24,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCRoom"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"geo": {
"point": {
"type": "Point",
@@ -188,5 +188,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCRoom"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "d7ce5623-ad47-5976-bdd3-7cf551729516",
"name": "Poolraum (HoF)",
"type": "room",
@@ -76,5 +76,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCRoom"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"query": "*",
"filter": {
"arguments": {
@@ -32,5 +32,6 @@
},
"type": "boolean"
}
}
},
"schema": "SCSearchRequest"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "b621f5b5-dd5d-5730-9e2e-e4ba52011388",
"type": "semester",
"name": "Wintersemester 2017/2018",
@@ -14,5 +14,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCSemester"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "aacd5611-b5be-54ce-b39f-c52f7e9a631d",
"type": "semester",
"name": "Sommersemester 2018",
@@ -16,5 +16,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCSemester"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"categories": [
"privacy"
],
@@ -27,5 +27,6 @@
},
"type": "setting",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217642"
}
},
"schema": "SCSetting"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"categories": [
"privacy"
],
@@ -37,5 +37,6 @@
},
"type": "setting",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217642"
}
},
"schema": "SCSetting"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "ticket",
"name": "Ticket",
"uid": "7257a1d7-47ac-4acc-a8cc-3f9ac6442e5d",
@@ -39,5 +39,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCTicket"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "7257a1d7-47ac-4acc-a8cc-3f9ac6442e5d",
"type": "tour",
"name": "Stundenplan erstellen",
@@ -99,5 +99,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCTour"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"uid": "7257a1d7-47ac-4acc-a8cc-3f9ac6442e5d",
"type": "tour",
"name": "Favorisierte Essensorte",
@@ -129,5 +129,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCTour"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "video",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217642",
"url": "https://vimeo.com/1084537",
@@ -9,5 +9,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCVideo"
}

View File

@@ -1,6 +1,6 @@
{
"validationErrorNames": [],
"scData": {
"errorNames": [],
"instance": {
"type": "video",
"uid": "540862f3-ea30-5b8f-8678-56b4dc217642",
"url": "https://vimeo.com/1084537",
@@ -46,5 +46,6 @@
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy"
}
}
},
"schema": "SCVideo"
}