Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
canonical test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Aug 26, 2015
1 parent d7bfb5f commit a8d3500
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/canonicals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var Builder = require('../index');
var builder = new Builder();

builder.loadConfigSync('./test/fixtures/test-tree.config.js');

builder.config({ transpiler: 'babel' });

var baseURL = builder.loader.baseURL;

suite('Canonical Names', function() {
test('Simple canonical', function() {
assert.equal(builder.getCanonicalName('amd.js'), 'amd.js');
});

test('Wildcard', function() {
assert.equal(builder.getCanonicalName(baseURL + 'test/fixtures/test-tree/asdf'), 'asdf');
});

test('Exact beats wildcard', function() {
assert.equal(builder.getCanonicalName(baseURL + 'node_modules/babel-core/browser.js'), 'babel');
});

test('Wildcard extensions', function() {
assert.equal(builder.getCanonicalName(baseURL + 'test/dummy/file.jade'), 'file.jade');
});
});
1 change: 1 addition & 0 deletions test/fixtures/test-tree.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ System.config({
},
paths: {
'*': './test/fixtures/test-tree/*',
'*.jade': './test/dummy/*.jade',
'babel': './node_modules/babel-core/browser.js',
'babel-helpers': './node_modules/babel-core/external-helpers.js',
'traceur': './node_modules/traceur/bin/traceur.js',
Expand Down

0 comments on commit a8d3500

Please sign in to comment.