Skip to content

Commit

Permalink
Add test ensuring /index doesn’t invokes callbacks the appropriate nu…
Browse files Browse the repository at this point in the history
…mber of times
  • Loading branch information
stefanpenner committed Jan 17, 2018
1 parent 1268caa commit 5141a0f
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/all.js
Expand Up @@ -1148,17 +1148,24 @@ test('manual /index fallback no ambiguity', function() {
});

test('manual /index fallback with ambiguity (alias after)', function() {
var counts = {
foo: 0,
'foo/index': 0
};

define('foo', [], function() {
counts.foo++;
return 'I AM foo';
});

define('foo/index', [], function() {
counts['foo/index']++;
return 'I AM foo/index';
});

define('foo', define.alias('foo/index'));

define('bar', ['foo'], function(foo) {
define('bar', ['foo', 'foo/index'], function(foo) {
return 'I AM bar with: ' + foo;
});

Expand All @@ -1168,17 +1175,22 @@ test('manual /index fallback with ambiguity (alias after)', function() {

var stats = statsForMonitor('loaderjs', tree);

deepEqual(counts, {
foo: 0,
'foo/index': 1
});

deepEqual(stats, {
findDeps: 2,
define: 4,
exports: 2,
findModule: 4,
findDeps: 2,
findModule: 5,
modules: 4,
pendingQueueLength: 2,
reify: 2,
require: 3,
resolve: 1,
resolveRelative: 0,
pendingQueueLength: 2
resolve: 2,
resolveRelative: 0
});
});

Expand Down

0 comments on commit 5141a0f

Please sign in to comment.