2020-05-15 22:24:11 +08:00
|
|
|
import value from "promise-external";
|
|
|
|
import request from "import-external";
|
|
|
|
|
|
|
|
it("should allow async externals", () => {
|
|
|
|
expect(value).toBe(42);
|
|
|
|
expect(request).toBe("/hello/world.js");
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should allow to catch errors of async externals", () => {
|
|
|
|
return expect(() => import("failing-promise-external")).rejects.toEqual(
|
|
|
|
expect.objectContaining({
|
|
|
|
message: "external reject"
|
|
|
|
})
|
|
|
|
);
|
|
|
|
});
|
2020-08-05 01:37:16 +08:00
|
|
|
|
|
|
|
it("should allow dynamic import promise externals", () => {
|
|
|
|
return import("promise-external").then(module => {
|
|
|
|
expect(module).toMatchObject({ default: value });
|
|
|
|
});
|
|
|
|
});
|