2018-12-26 13:12:29 -05:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2018-12-26 13:12:29 -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
|
|
|
|
*/
|
|
|
|
|
|
|
|
import {obsoleteInIvy, onlyInIvy} from '@angular/private/testing';
|
|
|
|
import {existsSync, readFileSync} from 'fs';
|
|
|
|
import {dirname, join} from 'path';
|
|
|
|
|
|
|
|
describe('flat_module ng_module', () => {
|
|
|
|
let packageOutput: string;
|
|
|
|
let flatModuleOutFile: string;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
packageOutput =
|
|
|
|
dirname(require.resolve('angular/packages/bazel/test/ngc-wrapped/flat_module/index.js'));
|
|
|
|
flatModuleOutFile = join(packageOutput, 'flat_module.js');
|
|
|
|
});
|
|
|
|
|
2020-04-13 19:40:21 -04:00
|
|
|
it('should have a flat module out file', () => {
|
|
|
|
expect(existsSync(flatModuleOutFile)).toBe(true);
|
|
|
|
});
|
2018-12-26 13:12:29 -05:00
|
|
|
|
|
|
|
describe('flat module out file', () => {
|
|
|
|
obsoleteInIvy('Ngtsc computes the AMD module name differently than NGC')
|
|
|
|
.it('should have a proper AMD module name', () => {
|
|
|
|
expect(readFileSync(flatModuleOutFile, 'utf8'))
|
|
|
|
.toContain(`define("flat_module/flat_module"`);
|
|
|
|
});
|
|
|
|
|
|
|
|
onlyInIvy('Ngtsc computes the AMD module name differently than NGC')
|
|
|
|
.it('should have a proper AMD module name', () => {
|
|
|
|
expect(readFileSync(flatModuleOutFile, 'utf8')).toContain(`define("flat_module"`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|