Skip to content

Commit

Permalink
test: improve integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
ldhyen99 committed Sep 23, 2024
1 parent c1784b1 commit 8503451
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ describe("CLI 'untp test' Commands with remote schema", () => {
it('should show FAIL in the report when data invalidate', () => {
expect(stdout).toMatch(/FAIL/);
expect(stdout).toMatch(/Your credentials are not UNTP compliant/);
expect(stdout).toContain('url field Failed to fetch data ');
expect(stdout).toContain('schema field Failed to fetch data ');
expect(stdout).toContain(`field must have required property 'id'.`);
expect(stdout).toContain(`url field The URL 'in-valid-url' is not a valid URL..`);
expect(stdout).toContain(`url field The URL 'abc://example.com' must use http or https protocol..`);
Expand Down Expand Up @@ -338,7 +338,7 @@ describe("CLI 'untp test' Commands with remote schema", () => {
expect(stdout).toMatch(/FAIL/);
expect(stdout).toMatch(/Your credentials are not UNTP compliant/);
expect(stdout).toContain('Additional property found');
expect(stdout).toContain('url field Failed to fetch data from the URL');
expect(stdout).toContain('schema field Failed to fetch data from the URL');
});
});
});
24 changes: 15 additions & 9 deletions packages/untp-test-suite/integration/lib/lib.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,21 @@ describe('lib.integration.test.ts', () => {
};

it('should throw an error when the credential is contain version empty', async () => {
await expect(
testCredentialHandler(
{
type: 'objectEvent',
version: '',
},
testDataMock,
),
).rejects.toThrow('ENOENT: no such file or directory');
const result = await testCredentialHandler(
{
type: 'objectEvent',
version: '',
},
testDataMock,
);

expect(result.errors).toEqual(
expect.arrayContaining([
expect.objectContaining({
message: expect.stringContaining('ENOENT: no such file or directory'),
}),
]),
);
});
});

Expand Down

0 comments on commit 8503451

Please sign in to comment.