2018-02-13 14:26:06 -05:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2018-02-13 14:26:06 -05:00
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
|
|
|
const fs = require('fs');
|
|
|
|
const PKG = 'angular/packages/compiler-cli/integrationtest/bazel/ng_module';
|
|
|
|
describe('flat module index', () => {
|
|
|
|
describe('child metadata', () => {
|
|
|
|
it('should have contents', () => {
|
|
|
|
const metadata = fs.readFileSync(
|
2018-03-15 21:04:34 -04:00
|
|
|
require.resolve(`${PKG}/flat_module_filename.metadata.json`), {encoding: 'utf-8'});
|
2018-02-13 14:26:06 -05:00
|
|
|
expect(metadata).toContain('"__symbolic":"module"');
|
|
|
|
expect(metadata).toContain('"__symbolic":"reference","module":"@angular/core"');
|
2018-03-26 17:34:44 -04:00
|
|
|
expect(metadata).toContain(
|
|
|
|
'"origins":{"Child":"./child","ɵangular_packages_compiler_cli_integrationtest_bazel_ng_module_test_module_a":"./parent"}');
|
2018-02-13 14:26:06 -05:00
|
|
|
expect(metadata).toContain('"importAs":"some_npm_module"');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('child typings', () => {
|
|
|
|
it('should have contents', () => {
|
2018-03-15 21:04:34 -04:00
|
|
|
const dts =
|
|
|
|
fs.readFileSync(require.resolve(`${PKG}/flat_module_filename.d.ts`), {encoding: 'utf-8'});
|
2018-02-13 14:26:06 -05:00
|
|
|
|
|
|
|
expect(dts).toContain('export * from \'./index\';');
|
2018-03-26 17:34:44 -04:00
|
|
|
expect(dts).toContain(
|
|
|
|
'export { Parent as ɵangular_packages_compiler_cli_integrationtest_bazel_ng_module_test_module_a } from \'./parent\';');
|
2018-02-13 14:26:06 -05:00
|
|
|
});
|
|
|
|
});
|
2020-05-19 15:08:49 -04:00
|
|
|
});
|