Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((tsFile: ts.SourceFile) => {
let contentsBaz = dependentFilesUtils.getImportClauses(tsFile);
let barExpectedContent = path.normalize('../bar/bar.component');
let fooBarExpectedContent =
`.${path.sep}qux${path.sep}quux${path.sep}foobar${path.sep}foobar.component`;
expect(contentsBaz[0].specifierText).toBe(barExpectedContent);
expect(contentsBaz[1].specifierText).toBe(fooBarExpectedContent);
})
.then(done, done.fail);
.then((tsFileFooQux: ts.SourceFile) => {
let contentsFooQux = dependentFilesUtils.getImportClauses(tsFileFooQux);
let fooQuxExpectedContent = path.normalize('../../../../foo/foobar.component');
expect(contentsFooQux[0].specifierText).toBe(fooQuxExpectedContent);
})
.then(() => dependentFilesUtils.createTsSourceFile(bazFile))
.then((tsFileBaz: ts.SourceFile) => {
let contentsBaz = dependentFilesUtils.getImportClauses(tsFileBaz);
let bazExpectedContent = path.normalize('../../foo/foobar.component');
expect(contentsBaz[1].specifierText).toBe(bazExpectedContent);
})
.then(() => resolver.resolveOwnImports())
.then((tsFile: ts.SourceFile) => {
let contents = dependentFilesUtils.getImportClauses(tsFile);
let expectedContents = [{
specifierText: '../bar.component',
pos: 13,
end: 32
}];
expect(contents).toEqual(expectedContents);
})
.then(done, done.fail);
.then((tsFileFooBar: ts.SourceFile) => {
let contentsFooBar = dependentFilesUtils.getImportClauses(tsFileFooBar);
let fooExpectedContent = `.${path.sep}foo.component`;
let fooQuxExpectedContent = path.normalize('../foo-baz/qux/quux/fooqux.component');
expect(contentsFooBar[0].specifierText).toBe(fooExpectedContent);
expect(contentsFooBar[1].specifierText).toBe(fooQuxExpectedContent);
})
.then(done, done.fail);
.then((tsFileFoo: ts.SourceFile) => {
let contentsFoo = dependentFilesUtils.getImportClauses(tsFileFoo);
let bazExpectedContent = path.normalize('../foo-baz/baz.component');
expect(contentsFoo[0].specifierText).toBe(bazExpectedContent);
})
.then(() => resolver.resolveOwnImports())
.then((tsFile: ts.SourceFile) => {
let contents = dependentFilesUtils.getImportClauses(tsFile);
let fooExpectedContent = path.normalize('../foo/foo.component');
expect(contents[0].specifierText).toBe(fooExpectedContent);
})
.then(done, done.fail);
.then((tsFileBar: ts.SourceFile) => {
let contentsBar = dependentFilesUtils.getImportClauses(tsFileBar);
let bazExpectedContent = path.normalize('../foo-baz/baz.component');
expect(contentsBar[0].specifierText).toBe(bazExpectedContent);
})
.then(() => dependentFilesUtils.createTsSourceFile(fooFile))