From ba2181803133d8699ef0a1143d41b26f9b672b15 Mon Sep 17 00:00:00 2001 From: Lars Trieloff <trieloff@adobe.com> Date: Mon, 18 Mar 2019 11:53:00 +0000 Subject: [PATCH] fix tests --- spec/examples/arrays.schema.md | 3 +++ spec/examples/complex.schema.md | 4 ++-- spec/examples/typearrays.schema.md | 15 +++++++++++++++ spec/lib/integrationTest.spec.js | 17 +++++++---------- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/spec/examples/arrays.schema.md b/spec/examples/arrays.schema.md index 9e88e32..99b0434 100644 --- a/spec/examples/arrays.schema.md +++ b/spec/examples/arrays.schema.md @@ -80,6 +80,7 @@ A simple string. + ##### foo Example ```json @@ -119,6 +120,7 @@ A simple string. + ##### bar Example ```json @@ -251,6 +253,7 @@ All items must be of the type: + ## listlist This is an array of arrays diff --git a/spec/examples/complex.schema.md b/spec/examples/complex.schema.md index 20d7b9e..1b08624 100644 --- a/spec/examples/complex.schema.md +++ b/spec/examples/complex.schema.md @@ -31,8 +31,8 @@ This is an example schema that uses types defined in other schemas. | [reflist](#reflist) | Simple | Optional | No | Complex References (this schema) | | [refnamed](#refnamed) | Simple | Optional | No | Complex References (this schema) | | [xor](#xor) | complex | Optional | No | Complex References (this schema) | -| `int.*` | `integer` | | Complex References (this schema) | -| `str.*` | `string` | | Complex References (this schema) | +| `int.*` | `integer` | Pattern No | Complex References (this schema) | +| `str.*` | `string` | Pattern No | Complex References (this schema) | | `*` | any | Additional | Yes | this schema *allows* additional properties | ## and diff --git a/spec/examples/typearrays.schema.md b/spec/examples/typearrays.schema.md index a31629b..0355644 100644 --- a/spec/examples/typearrays.schema.md +++ b/spec/examples/typearrays.schema.md @@ -30,6 +30,7 @@ This schema test type arrays and nullable types This is just nothing `null` + * is optional * type: `null` * defined in this schema @@ -48,6 +49,7 @@ This property can only have the value `null`. Nullable string `string-or-null` + * is optional * type: `string` * defined in this schema @@ -62,11 +64,13 @@ Nullable string + ## string-or-number Types can be many things `string-or-number` + * is optional * type: multiple * defined in this schema @@ -87,6 +91,7 @@ Either one of: Types can be many things, even nothing at all. `string-or-number-null` + * is optional * type: multiple * defined in this schema @@ -102,3 +107,13 @@ Either one of: + + +**All** of the following *requirements* need to be fulfilled. + + +#### Requirement 1 + + +* []() – `#/definitions/id` + diff --git a/spec/lib/integrationTest.spec.js b/spec/lib/integrationTest.spec.js index 85cd929..a505c5c 100644 --- a/spec/lib/integrationTest.spec.js +++ b/spec/lib/integrationTest.spec.js @@ -1,11 +1,12 @@ const { spawn } = require('child_process'); -const { readFile, readdirSync, statSync } = require('fs'); +const path = require('path'); +const { readFileSync, readdirSync, statSync } = require('fs'); beforeEach(function() { jasmine.addMatchers( require('jasmine-diff')(jasmine, { colors: true, - inline: true + inline: false }) ); }); @@ -64,14 +65,10 @@ describe('Compare results', () => { if (statSync('./spec/examples/' + file).isFile()) { it('Comparing ' + file, indone => { console.log('file ' + file); - readFile('./spec/examples/' + file, (err, expectedbuf) => { - expect(err).toBeNull(); - readFile('./examples/docs/' + file, (err, actualbuf) => { - expect(err).toBeNull(); - expect(actualbuf.toString()).toEqual(expectedbuf.toString()); - indone(); - }); - }); + const expectedstr = readFileSync(path.resolve('./spec/examples/', file)).toString(); + const actualstr = readFileSync(path.resolve('./examples/docs/', file)).toString(); + expect(actualstr).toEqual(expectedstr); + indone(); }); } }); -- GitLab