Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Finished tests
  • Loading branch information
robtpaton authored and Trott committed Nov 1, 2017
commit 3f3608f927165c491b92a2f34751ffcfef92428c
23 changes: 17 additions & 6 deletions test/es-module/test-esm-loader-modulemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,32 @@ const moduleJob = new ModuleJob(loader, stubModule.module);

assert.throws(() => {
moduleMap.get(1);
}, 'TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string');
}, /TypeError \[ERR_INVALID_ARG_TYPE\]: The "url" argument must be of type string/);

assert.doesNotThrow(() => {
moduleMap.get('somestring');
});

assert.throws(() => {
moduleMap.has(1);
}, 'TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string');
moduleMap.set(1, moduleJob);
}, /TypeError \[ERR_INVALID_ARG_TYPE\]: The "url" argument must be of type string/);

assert.doesNotThrow(() => {
moduleMap.has('somestring');
moduleMap.set('somestring', moduleJob);
});

assert.throws(() => {
moduleMap.set(1, moduleJob);
}, 'TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string');
moduleMap.set('somestring', 'notamodulejob');
}, /TypeError \[ERR_INVALID_ARG_TYPE\]: The "job" argument must be of type ModuleJob/);

assert.doesNotThrow(() => {
moduleMap.set('somestring', moduleJob);
});

assert.throws(() => {
moduleMap.has(1);
}, /TypeError \[ERR_INVALID_ARG_TYPE\]: The "url" argument must be of type string/);

assert.doesNotThrow(() => {
moduleMap.has('somestring');
});