2018-01-16 04:26:47 +08:00
|
|
|
it("should answer typeof System correctly", () => {
|
2018-06-26 16:59:23 +08:00
|
|
|
if(__SYSTEM__) {
|
2018-01-27 05:51:03 +08:00
|
|
|
expect((typeof System)).toBe("object");
|
2018-06-26 16:59:23 +08:00
|
|
|
} else {
|
|
|
|
expect((typeof System)).toBe("undefined");
|
2018-01-16 04:26:47 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should answer typeof System.import correctly", () => {
|
2018-06-26 16:59:23 +08:00
|
|
|
if(__SYSTEM__) {
|
|
|
|
expect((typeof System.import)).toBe("function");
|
|
|
|
} else {
|
2018-01-27 06:59:38 +08:00
|
|
|
expect(() => {
|
2018-01-16 04:26:47 +08:00
|
|
|
typeof System.import;
|
2018-01-27 06:59:38 +08:00
|
|
|
}).toThrowError();
|
2018-01-16 04:26:47 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should be able to use System.import()", done => {
|
|
|
|
try {
|
|
|
|
System.import("./module").then(mod => {
|
2018-06-26 16:59:23 +08:00
|
|
|
if(__SYSTEM__) {
|
2018-07-11 17:13:47 +08:00
|
|
|
expect(mod).toEqual(nsObj({
|
|
|
|
default: "ok"
|
|
|
|
}));
|
2018-01-16 04:26:47 +08:00
|
|
|
done();
|
2018-06-26 16:59:23 +08:00
|
|
|
} else {
|
|
|
|
done(new Error("System.import should not be parsed"));
|
2018-01-16 04:26:47 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} catch(e) {
|
2018-06-26 16:59:23 +08:00
|
|
|
if(__SYSTEM__) {
|
2018-01-16 04:26:47 +08:00
|
|
|
done(e);
|
2018-06-26 16:59:23 +08:00
|
|
|
} else {
|
|
|
|
done();
|
2018-01-16 04:26:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|