Skip to content

Commit

Permalink
fix: test case of loader
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia committed May 7, 2020
1 parent 8c5a63d commit 314633a
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions packages/icestark-module/tests/loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,25 @@ describe('module loader', () => {
});
const moduleLoader = new ModuleLoader();

test('load module', () => {
test('load module', async () => {
const task = moduleLoader.load({
url: '//localhost',
name: 'test',
});
task.then((text) => {
expect(text).toEqual('//localhost');
});
const res = await task;
expect(res).toEqual(['//localhost']);
});

test('load cache', () => {
test('load cache', async () => {
const task = moduleLoader.load({ name: 'test', url: '//localhost2' });
task.then((text) => {
expect(text).toEqual('//localhost');
});
const res = await task;
expect(res).toEqual(['//localhost']);
});

test('load source', () => {
test('load source', async () => {
const task = moduleLoader.load({ name: 'testsource', url: '//source' });
task.then((text) => {
expect(text).toEqual(source.toString());
});
const res = await task;
expect(res).toEqual([source.toString()]);
});

test('execute module', async () => {
Expand Down

0 comments on commit 314633a

Please sign in to comment.