Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
Split up tests (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Sep 17, 2018
1 parent a0ebbb4 commit 9e26438
Show file tree
Hide file tree
Showing 7 changed files with 728 additions and 735 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sudo: false
language: node_js
node_js:
- "4"
- "6"
- "8"
- "10"
Expand All @@ -10,4 +9,4 @@ env:
- BUILD_TIMEOUT=10000
install: npm install --ignore-scripts
before_install:
- if [[ $TRAVIS_NODE_VERSION -lt 7 ]]; then npm install --global npm@4; fi
- if [[ $TRAVIS_NODE_VERSION -lt 8 ]]; then npm install --global npm@5; fi
27 changes: 27 additions & 0 deletions test/addExtension.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const assert = require( 'assert' );
const addExtension = require( '..' ).addExtension;

describe( 'addExtension', function () {
it( 'adds .js to an ID without an extension', function () {
assert.equal( addExtension( 'foo' ), 'foo.js' );
});

it( 'ignores file with existing extension', function () {
assert.equal( addExtension( 'foo.js' ), 'foo.js' );
assert.equal( addExtension( 'foo.json' ), 'foo.json' );
});

it( 'ignores file with trailing dot', function () {
assert.equal( addExtension( 'foo.' ), 'foo.' );
});

it( 'ignores leading .', function () {
assert.equal( addExtension( './foo' ), './foo.js' );
assert.equal( addExtension( './foo.js' ), './foo.js' );
});

it( 'adds a custom extension', function () {
assert.equal( addExtension( 'foo', '.wut' ), 'foo.wut' );
assert.equal( addExtension( 'foo.lol', '.wut' ), 'foo.lol' );
});
});
Loading

0 comments on commit 9e26438

Please sign in to comment.