Skip to content

Commit

Permalink
fix regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
cice committed Mar 30, 2020
1 parent a9cd86b commit dc6bed8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HttpResponse } from '@angular/common/http';
import { Inject } from '@angular/core';
import { Injectable } from '@angular/core';
import { API_HOST } from './api-host';
import { GetResponse } from './get-response';
import { GetResponse } from './users/get-response';
@Injectable()
export class UsersGateway {
constructor(private readonly _httpClient: HttpClient, @Inject(API_HOST) private readonly _apiHost: string) {}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@types/jest": "^25.1.4",
"@types/json-schema": "^7.0.4",
"@types/lodash-es": "^4.17.3",
"dir-compare": "^2.2.0",
"jest": "^25.2.1",
"json-schema": "^0.2.5",
"rxjs": "^6.5.4",
Expand Down
13 changes: 6 additions & 7 deletions test/integration/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import {promises as fs} from 'fs';
import {generateGatewayFiles} from '../../src';
import {compare} from 'dir-compare';

test('simple-endpoint-without-refs', async() => {
const input = 'examples/hyper-schema/simple-endpoint-without-refs.json';
const expectedFiles = 'examples/generated/simple-endpoint-without-refs';
const output = 'tmp/simple-endpoint-without-refs';
await fs.rmdir(output, {recursive: true});

await fs.mkdir(output, {recursive: true});

await generateGatewayFiles(input, output);

const dir = await fs.opendir(expectedFiles);
for await (const entry of dir) {
if (entry.isFile()) {
const generated = fs.readFile(`${output}/${entry.name}`, 'utf8');
const expected = fs.readFile(`${expectedFiles}/${entry.name}`, 'utf8');
const result = await compare(expectedFiles, output, {compareContent: true});

expect((await generated)).toEqual(await expected);
}
if(!result.same) {
console.log(result.diffSet?.filter((diff) => diff.state !== 'equal'));
}
expect(result.same).toBeTruthy();
});
41 changes: 40 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ bcrypt-pbkdf@^1.0.0:
dependencies:
tweetnacl "^0.14.3"

brace-expansion@^1.1.7:
brace-expansion@^1.0.0, brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
Expand Down Expand Up @@ -812,6 +812,11 @@ [email protected]:
dependencies:
node-int64 "^0.4.0"

[email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/buffer-equal/-/buffer-equal-1.0.0.tgz#59616b498304d556abd466966b22eeda3eca5fbe"
integrity sha1-WWFrSYME1Var1GaWayLu2j7KX74=

[email protected], buffer-from@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
Expand Down Expand Up @@ -989,13 +994,25 @@ color-name@~1.1.4:
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==

[email protected]:
version "1.0.3"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b"
integrity sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=

combined-stream@^1.0.6, combined-stream@~1.0.6:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"

[email protected]:
version "2.9.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
integrity sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=
dependencies:
graceful-readlink ">= 1.0.0"

component-emitter@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
Expand Down Expand Up @@ -1164,6 +1181,16 @@ diff-sequences@^25.2.1:
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.2.1.tgz#fcfe8aa07dd9b0c648396a478dabca8e76c6ab27"
integrity sha512-foe7dXnGlSh3jR1ovJmdv+77VQj98eKCHHwJPbZ2eEf0fHwKbkZicpPxEch9smZ+n2dnF6QFwkOQdLq9hpeJUg==

dir-compare@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/dir-compare/-/dir-compare-2.2.0.tgz#945ae53b685cba8de7172442c657d5bcbef680b9"
integrity sha512-cmOgS23lSolrsdrDSwWdu/USalfXEwQ/4r3MyIur2U/td2pIp8TnO71ME4M8siaE49xg43tIVX3XzriDOgfdow==
dependencies:
buffer-equal "1.0.0"
colors "1.0.3"
commander "2.9.0"
minimatch "3.0.2"

domexception@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90"
Expand Down Expand Up @@ -1536,6 +1563,11 @@ graceful-fs@^4.2.3:
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==

"graceful-readlink@>= 1.0.0":
version "1.0.1"
resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725"
integrity sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=

growly@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
Expand Down Expand Up @@ -2532,6 +2564,13 @@ mimic-fn@^2.1.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==

[email protected]:
version "3.0.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.2.tgz#0f398a7300ea441e9c348c83d98ab8c9dbf9c40a"
integrity sha1-DzmKcwDqRB6cNIyD2Yq4ydv5xAo=
dependencies:
brace-expansion "^1.0.0"

minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
Expand Down

0 comments on commit dc6bed8

Please sign in to comment.