Skip to content

Commit

Permalink
Use Jasmine for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bcmarinacci committed May 24, 2016
1 parent 24f433e commit 12f9fbb
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 31 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
},
"main": "index.js",
"scripts": {
"lint": "eslint --fix index.js test/",
"lint": "eslint --fix index.js spec/",
"prepublish": "npm run test",
"test": "istanbul cover tape -- test/**/*.test.js && npm run lint",
"test": "istanbul cover jasmine && npm run lint",
"preversion": "npm run test",
"postversion": "git push && git push --tags"
},
Expand Down Expand Up @@ -40,6 +40,6 @@
"eslint-plugin-jsx-a11y": "^1.2.0",
"eslint-plugin-react": "^5.1.1",
"istanbul": "^0.4.3",
"tape": "^4.5.1"
"jasmine": "^2.4.1"
}
}
27 changes: 27 additions & 0 deletions spec/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* eslint-disable prefer-arrow-callback */
'use strict';

const trim = require('../');

describe('trimWhitespace', function () {
it('should remove leading and trailing spaces and tabs', function () {
expect(trim(' Anakin Skywalker \n Padme Amidala ')).toEqual('Anakin Skywalker\nPadme Amidala');
expect(trim('\t\tAnakin Skywalker\t\t\n\t\tPadme Amidala\t\t')).toEqual('Anakin Skywalker\nPadme Amidala');
expect(trim(' \tAnakin Skywalker \t\n\t Padme Amidala\t ')).toEqual('Anakin Skywalker\nPadme Amidala');
expect(trim('\n \tAnakin Skywalker \t\n\t Padme Amidala\t \n')).toEqual('\nAnakin Skywalker\nPadme Amidala\n');
});

it('should remove leading spaces and tabs', function () {
expect(trim.leading(' Anakin Skywalker \n Padme Amidala ')).toEqual('Anakin Skywalker \nPadme Amidala ');
expect(trim.leading('\t\tAnakin Skywalker\t\t\n\t\tPadme Amidala\t\t')).toEqual('Anakin Skywalker\t\t\nPadme Amidala\t\t');
expect(trim.leading(' \tAnakin Skywalker \t\n\t Padme Amidala\t ')).toEqual('Anakin Skywalker \t\nPadme Amidala\t ');
expect(trim.leading('\n \tAnakin Skywalker \t\n\t Padme Amidala\t \n')).toEqual('\nAnakin Skywalker \t\nPadme Amidala\t \n');
});

it('should remove trailing spaces and tabs', function () {
expect(trim.trailing(' Anakin Skywalker \n Padme Amidala ')).toEqual(' Anakin Skywalker\n Padme Amidala');
expect(trim.trailing('\t\tAnakin Skywalker\t\t\n\t\tPadme Amidala\t\t')).toEqual('\t\tAnakin Skywalker\n\t\tPadme Amidala');
expect(trim.trailing(' \tAnakin Skywalker \t\n\t Padme Amidala\t ')).toEqual(' \tAnakin Skywalker\n\t Padme Amidala');
expect(trim.trailing('\n \tAnakin Skywalker \t\n\t Padme Amidala\t \n')).toEqual('\n \tAnakin Skywalker\n\t Padme Amidala\n');
});
});
11 changes: 11 additions & 0 deletions spec/support/jasmine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"spec_dir": "spec",
"spec_files": [
"**/*[sS]pec.js"
],
"helpers": [
"helpers/**/*.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
}
28 changes: 0 additions & 28 deletions test/index.test.js

This file was deleted.

0 comments on commit 12f9fbb

Please sign in to comment.