Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit e156e5f

Browse files
committed
test(deep-linking): make tests platform independent
make tests platform independent
1 parent 725ca69 commit e156e5f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/deep-linking/util.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,13 @@ export function removeDecorators(fileName: string, source: string): string {
552552
});
553553

554554
describe('getRelativePathToPageNgModuleFromAppNgModule', () => {
555-
const prefix = join(process.cwd(), 'myApp', 'src');
556-
const appNgModulePath = join(prefix, 'app', 'app.module.ts');
557-
const pageNgModulePath = join(prefix, 'pages', 'page-one', 'page-one.module.ts');
558-
const result = util.getRelativePathToPageNgModuleFromAppNgModule(appNgModulePath, pageNgModulePath);
559-
expect(result).toEqual('../pages/page-one/page-one.module.ts');
555+
it('should return the relative path', () => {
556+
const prefix = join(process.cwd(), 'myApp', 'src');
557+
const appNgModulePath = join(prefix, 'app', 'app.module.ts');
558+
const pageNgModulePath = join(prefix, 'pages', 'page-one', 'page-one.module.ts');
559+
const result = util.getRelativePathToPageNgModuleFromAppNgModule(appNgModulePath, pageNgModulePath);
560+
expect(result).toEqual(join('..', 'pages', 'page-one', 'page-one.module.ts'));
561+
});
560562
});
561563

562564
describe('getNgModuleDataFromPage', () => {

src/deep-linking/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import { Logger } from '../logger/logger';
1818
import * as Constants from '../util/constants';
1919
import { FileCache } from '../util/file-cache';
20-
import { changeExtension, getStringPropertyValue, replaceAll } from '../util/helpers';
20+
import { changeExtension, getStringPropertyValue, replaceAll, toUnixPath } from '../util/helpers';
2121
import { BuildContext, ChangedFile, DeepLinkConfigEntry, DeepLinkDecoratorAndClass, DeepLinkPathInfo, File } from '../util/interfaces';
2222
import {
2323
appendAfter,
@@ -81,7 +81,7 @@ export function getNgModuleDataFromPage(appNgModuleFilePath: string, filePath: s
8181

8282
return {
8383
absolutePath: absolutePath,
84-
userlandModulePath: userlandModulePath,
84+
userlandModulePath: toUnixPath(userlandModulePath),
8585
className: namedExport
8686
};
8787
}

0 commit comments

Comments
 (0)