Skip to content

Commit

Permalink
chore: commit generated fixtures and allow ci tests to catch any drifts
Browse files Browse the repository at this point in the history
  • Loading branch information
phanshiyu committed May 2, 2024
1 parent 1e5b23d commit 9f0ba1f
Show file tree
Hide file tree
Showing 13 changed files with 753 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ yarn.lock
/public
/vc-test-suite
/.vscode

/test/fixtures/v4/__generated__/
17 changes: 17 additions & 0 deletions src/4.0/__tests__/fixtures.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import fs from "fs";
import path from "path";
import * as FIXTURES from "../fixtures";

const PATH_TO_GENERATED_FIXTURES = path.resolve(__dirname, "../../../test/fixtures/v4/__generated__");

describe("assert fixtures matches generated JSON fixtures", () => {
for (const fixtureName of Object.keys(FIXTURES)) {
const jsonFixtureFilename = fixtureName.replace(/_/g, "-").toLowerCase() + ".json";

test(`${jsonFixtureFilename} should match the one defined in fixtures.ts`, () => {
const fixture = FIXTURES[fixtureName as keyof typeof FIXTURES];
const jsonFixture = fs.readFileSync(path.resolve(PATH_TO_GENERATED_FIXTURES, jsonFixtureFilename), "utf-8");
expect(fixture).toEqual(JSON.parse(jsonFixture));
});
}
});
91 changes: 91 additions & 0 deletions test/fixtures/v4/__generated__/batched-raw-documents-did.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9f0ba1f

Please sign in to comment.