作者:smart-web-roc
项目:angula
it('should create a reexport', () => {
expect(emitStmt(someVar.set(o.importExpr(externalModuleIdentifier))
.toDeclStmt(null, [o.StmtModifier.Exported])))
.toEqual([
`export {someExternalId as someVar} from 'somePackage/someOtherPath';`, ``
].join('\n'));
});
作者:manekinekk
项目:angula
it('should create multiple reexports from the same file', () => {
const someVar2 = o.variable('someVar2');
const externalModuleIdentifier2: CompileIdentifierMetadata = {
reference: new StaticSymbol(anotherModuleUrl, 'someExternalId2', [])
};
expect(emitStmt(
[
someVar.set(o.importExpr(externalModuleIdentifier)).toDeclStmt(),
someVar2.set(o.importExpr(externalModuleIdentifier2)).toDeclStmt()
],
['someVar', 'someVar2']))
.toEqual([
`export {someExternalId as someVar,someExternalId2 as someVar2} from 'somePackage/someOtherPath';`,
``
].join('\n'));
});
作者:DanielKuca
项目:angula
it('should create no reexport if the variable is typed', () => {
expect(emitStmt(someVar.set(o.importExpr(externalModuleIdentifier))
.toDeclStmt(o.DYNAMIC_TYPE, [o.StmtModifier.Exported])))
.toEqual([
`import * as i0 from 'somePackage/someOtherPath';`,
`export var someVar:any = i0.someExternalId;`
].join('\n'));
});
作者:Cammisul
项目:angula
it('should insert imports after existing imports', () => {
context = context.override({
somePackage: {
'someGenFile.ts': `
import {Component} from '@angular/core';
@Component({selector: 'some-class', template: 'hello!'})
export class SomeClass {}
export class SomeOtherClass {}
`
}
});
host = new MockCompilerHost(context);
expect(emitStaticMethod(new o.ReturnStatement(
o.importExpr(new o.ExternalReference('@angular/core', 'Component')))))
.toContain('const core_1 = require("@angular/core"); const i0 = require("@angular/core");');
});
作者:AnthonyPAlice
项目:angula
[o.literalArr([...externalIds1, ...externalIds].map(id => o.importExpr(id))).toStmt()],