From a5e97bf777f1d3d3da6710badf646ff6437c018c Mon Sep 17 00:00:00 2001
From: Lars Trieloff <trieloff@adobe.com>
Date: Mon, 18 Mar 2019 12:02:53 +0000
Subject: [PATCH] Fix async issue in tests, fix missing pipe between Pattern
 and nullable

---
 examples/docs/complex.schema.md  |  4 ++--
 spec/examples/complex.schema.md  |  4 ++--
 spec/lib/integrationTest.spec.js | 24 ++++++++++--------------
 templates/md/properties.ejs      |  2 +-
 4 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/examples/docs/complex.schema.md b/examples/docs/complex.schema.md
index 1b08624..098be5c 100644
--- a/examples/docs/complex.schema.md
+++ b/examples/docs/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` | Pattern  No | Complex References  (this schema) |
-| `str.*` | `string` | Pattern  No | 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/complex.schema.md b/spec/examples/complex.schema.md
index 1b08624..098be5c 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` | Pattern  No | Complex References  (this schema) |
-| `str.*` | `string` | Pattern  No | 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/lib/integrationTest.spec.js b/spec/lib/integrationTest.spec.js
index a505c5c..061d7de 100644
--- a/spec/lib/integrationTest.spec.js
+++ b/spec/lib/integrationTest.spec.js
@@ -6,7 +6,7 @@ beforeEach(function() {
   jasmine.addMatchers(
     require('jasmine-diff')(jasmine, {
       colors: true,
-      inline: false
+      inline: true
     })
   );
 });
@@ -56,20 +56,16 @@ describe('Compare results', () => {
       expect(code).toEqual(0);
       const files = readdirSync('./spec/examples').filter(item => !(/(^|\/)\.[^\/\.]/g).test(item));
       expect(files.length).toEqual(21);
-      done();
-    });
-  });
 
-  const files = readdirSync('./spec/examples').filter(item => !(/(^|\/)\.[^\/\.]/g).test(item));
-  files.forEach(file => {
-    if (statSync('./spec/examples/' + file).isFile()) {
-      it('Comparing ' + file, indone => {
-        console.log('file ' + file);
-        const expectedstr = readFileSync(path.resolve('./spec/examples/', file)).toString();
-        const actualstr = readFileSync(path.resolve('./examples/docs/', file)).toString();
-        expect(actualstr).toEqual(expectedstr);
-        indone();
+      files.forEach(file => {
+        if (statSync('./spec/examples/' + file).isFile()) {
+          const expectedstr = readFileSync(path.resolve('./spec/examples/', file)).toString();
+          const actualstr = readFileSync(path.resolve('./examples/docs/', file)).toString();
+          expect(actualstr).toEqual(expectedstr, file + ' does not match');
+        }
       });
-    }
+
+      done();
+    });
   });
 });
diff --git a/templates/md/properties.ejs b/templates/md/properties.ejs
index 238928f..73cdec1 100644
--- a/templates/md/properties.ejs
+++ b/templates/md/properties.ejs
@@ -21,7 +21,7 @@
 });
 %><% _.keys(pprops).forEach(property => {
   const schema = pprops[property]; %>
-| `<%= property.replace(':', '') %>` | <%= schema.simpletype %> | Pattern  <%= schema.nullable === true ? "Yes" : "No" %> |<% if(hasDefault) { %> <% if (schema.default!==undefined) { %>`<%- JSON.stringify(schema.default) %>`<% } %> |<% } %> <%
+| `<%= property.replace(':', '') %>` | <%= schema.simpletype %> | Pattern | <%= schema.nullable === true ? "Yes" : "No" %> |<% if(hasDefault) { %> <% if (schema.default!==undefined) { %>`<%- JSON.stringify(schema.default) %>`<% } %> |<% } %> <%
     if (schema.$oSchema) { 
       %>[<%= schema.$oSchema.$linkVal %>](<%= schema.$oSchema.$linkPath %>#<%= property.replace(':', '').toLowerCase() %>)<% 
     } else { 
-- 
GitLab