Skip to content

Commit

Permalink
Fix failing unit tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed May 19, 2021
1 parent d3a5bd6 commit 29d4a39
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion test/parse/ClassFinder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('ClassFinder', () => {
unnamed: [
{
packageName: 'other-package',
fileName: Path.normalize('/some-dir/index'),
fileName: '/some-dir/index',
},
],
});
Expand Down
3 changes: 1 addition & 2 deletions test/parse/ClassIndexer.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as Path from 'path';
import { ClassFinder } from '../../lib/parse/ClassFinder';
import { ClassIndexer } from '../../lib/parse/ClassIndexer';
import { ClassLoader } from '../../lib/parse/ClassLoader';
Expand Down Expand Up @@ -292,7 +291,7 @@ export { X as B } from 'other-package'
superClass: {
packageName: 'other-package',
localName: 'X',
fileName: Path.normalize('/some-dir/index'),
fileName: '/some-dir/index',
declaration: {
id: { name: 'X' },
type: 'ClassDeclaration',
Expand Down
14 changes: 7 additions & 7 deletions test/parse/ClassLoader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ declare interface A{}
describe('importTargetToAbsolutePath', () => {
it('for a local file', () => {
expect(loader.importTargetToAbsolutePath('package', 'dir/lib/fileA', './subdir/fileB'))
.toEqual({ packageName: 'package', fileName: 'dir/lib/subdir/fileB' });
.toEqual({ packageName: 'package', fileName: Path.normalize('dir/lib/subdir/fileB') });
});

it('for a package', () => {
Expand All @@ -835,13 +835,13 @@ declare interface A{}
});

it('for a file in a package', () => {
resolutionContext.packageNameIndexOverrides['other-package'] = '/some-dir/index.js';
resolutionContext.packageNameIndexOverrides['other-package'] = Path.normalize('/some-dir/index.js');
expect(loader.importTargetToAbsolutePath('package', 'dir/lib/fileA', 'other-package/lib/bla'))
.toEqual({ packageName: 'other-package', fileName: '/some-dir/lib/bla' });
.toEqual({ packageName: 'other-package', fileName: Path.normalize('/some-dir/lib/bla') });
});

it('for a scoped package', () => {
resolutionContext.packageNameIndexOverrides['@rubensworks/other-package'] = '/some-dir/index.js';
resolutionContext.packageNameIndexOverrides['@rubensworks/other-package'] = Path.normalize('/some-dir/index.js');
expect(loader.importTargetToAbsolutePath('package', 'dir/lib/fileA', '@rubensworks/other-package'))
.toEqual({ packageName: '@rubensworks/other-package', fileName: '/some-dir/index' });
});
Expand All @@ -852,9 +852,9 @@ declare interface A{}
});

it('for a file in a scoped package', () => {
resolutionContext.packageNameIndexOverrides['@rubensworks/other-package'] = '/some-dir/index.js';
resolutionContext.packageNameIndexOverrides['@rubensworks/other-package'] = Path.normalize('/some-dir/index.js');
expect(loader.importTargetToAbsolutePath('package', 'dir/lib/fileA', '@rubensworks/other-package/lib/bla'))
.toEqual({ packageName: '@rubensworks/other-package', fileName: '/some-dir/lib/bla' });
.toEqual({ packageName: '@rubensworks/other-package', fileName: Path.normalize('/some-dir/lib/bla') });
});
});

Expand Down Expand Up @@ -1000,7 +1000,7 @@ declare interface A{}
expect(loader.getClassElements('package', fileName, resolutionContext.parseTypescriptContents(`export * from 'other-package'`)))
.toMatchObject({
exportedImportedAll: [
{ packageName: 'other-package', fileName: Path.normalize('/some-dir/index') },
{ packageName: 'other-package', fileName: '/some-dir/index' },
],
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/parse/ParameterResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ export interface MyInterface extends IgnoredInterface{};
});

describe('resolveRangeInterface', () => {
const classReference: ClassReference = { packageName: 'P', localName: 'A', fileName: 'A' };
const classReference: ClassReferenceLoaded = <any> { packageName: 'P', localName: 'A', fileName: 'A' };

it('should error on a non-existing interface', async() => {
resolutionContext.contentsOverrides = {
Expand Down

0 comments on commit 29d4a39

Please sign in to comment.