Skip to content

Commit

Permalink
test: update refToPath test
Browse files Browse the repository at this point in the history
  • Loading branch information
toomuchdesign committed Mar 4, 2024
1 parent c7209bf commit c74d5df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/unit/makeRelativePath.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { makeRelativePath } from '../../src/utils';
import path from 'node:path';
import { makeRelativePath } from '../../src/utils';

describe('makeRelativePath', () => {
it.each([
Expand Down
5 changes: 3 additions & 2 deletions test/unit/refToPath.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { describe, it, expect } from 'vitest';
import path from 'node:path';
import { refToPath } from '../../src/utils';

describe('refToPath', () => {
it('generates expected ref paths', () => {
const actual = refToPath('#/components/schema/Foo');
const expected = {
schemaName: 'Foo',
schemaRelativeDirName: 'components/schema',
schemaRelativePath: 'components/schema/Foo',
schemaRelativeDirName: 'components/schema'.replaceAll('/', path.sep),
schemaRelativePath: 'components/schema/Foo'.replaceAll('/', path.sep),
};

expect(actual).toEqual(expected);

Check failure on line 14 in test/unit/refToPath.test.ts

View workflow job for this annotation

GitHub Actions / test-and-build (20, windows-latest)

test/unit/refToPath.test.ts > refToPath > generates expected ref paths

AssertionError: expected { …(3) } to deeply equal { schemaName: 'Foo', …(2) } - Expected + Received Object { "schemaName": "Foo", - "schemaRelativeDirName": "components\\schema", + "schemaRelativeDirName": "components/schema", "schemaRelativePath": "components\\schema\\Foo", } ❯ test/unit/refToPath.test.ts:14:20
Expand Down

0 comments on commit c74d5df

Please sign in to comment.