diff --git a/__tests__/components/MainList.react.jest.js b/__tests__/components/MainList.react.jest.js new file mode 100644 index 0000000..8ae0d98 --- /dev/null +++ b/__tests__/components/MainList.react.jest.js @@ -0,0 +1,17 @@ +jest.dontMock('../../assets/js/components/MainList.react.js'); + +describe('MainList', function() { + var React, MainList, TestUtils, Component; + + beforeEach(function() { + // Setup our tools + React = require('react/addons'); + MainList = require('../../assets/js/components/MainList.react.js'); + TestUtils = React.addons.TestUtils; + // Create the React component here using TestUtils and store into Component + }); + + it('should work', function() { + expect(2 + 2).toEqual(4); + }); +}); \ No newline at end of file diff --git a/__tests__/components/Navbar.react.jest.js b/__tests__/components/Navbar.react.jest.js new file mode 100644 index 0000000..9e8ff1f --- /dev/null +++ b/__tests__/components/Navbar.react.jest.js @@ -0,0 +1,17 @@ +jest.dontMock('../../assets/js/components/Navbar.react.js'); + +describe('Navbar', function() { + var React, Navbar, TestUtils, Component; + + beforeEach(function() { + // Setup our tools + React = require('react/addons'); + Navbar = require('../../assets/js/components/Navbar.react.js'); + TestUtils = React.addons.TestUtils; + // Create the React component here using TestUtils and store into Component + }); + + it('should work', function() { + expect(2 + 2).toEqual(4); + }); +}); \ No newline at end of file diff --git a/__tests__/components/Wakatime.react.jest.js b/__tests__/components/Wakatime.react.jest.js new file mode 100644 index 0000000..1beedc7 --- /dev/null +++ b/__tests__/components/Wakatime.react.jest.js @@ -0,0 +1,17 @@ +jest.dontMock('../../assets/js/components/Wakatime.react.js'); + +describe('Wakatime', function() { + var React, Wakatime, TestUtils, Component; + + beforeEach(function() { + // Setup our tools + React = require('react/addons'); + Wakatime = require('../../assets/js/components/Wakatime.react.js'); + TestUtils = React.addons.TestUtils; + // Create the React component here using TestUtils and store into Component + }); + + it('should work', function() { + expect(2 + 2).toEqual(4); + }); +}); \ No newline at end of file diff --git a/__tests__/helpers/changeExtensionIcon.spec.js b/__tests__/helpers/changeExtensionIcon.spec.js new file mode 100644 index 0000000..fad2a76 --- /dev/null +++ b/__tests__/helpers/changeExtensionIcon.spec.js @@ -0,0 +1,10 @@ +var chai = require('chai'); +var expect = chai.expect; + +import changeExtensionIcon from '../../assets/js/helpers/changeExtensionIcon'; + +describe('changeExtensionIcon', function() { + it('should be a function', function() { + expect(changeExtensionIcon).to.be.a('function'); + }); +}); \ No newline at end of file diff --git a/__tests__/helpers/currentTimestamp.spec.js b/__tests__/helpers/currentTimestamp.spec.js new file mode 100644 index 0000000..bad6a30 --- /dev/null +++ b/__tests__/helpers/currentTimestamp.spec.js @@ -0,0 +1,10 @@ +var chai = require('chai'); +var expect = chai.expect; + +import currentTimestamp from '../../assets/js/helpers/currentTimestamp'; + +describe('currentTimestamp', function() { + it('should be a function', function() { + expect(currentTimestamp).to.be.a('function'); + }); +}); \ No newline at end of file diff --git a/__tests__/preprocessor.js b/__tests__/preprocessor.js new file mode 100644 index 0000000..27ea74c --- /dev/null +++ b/__tests__/preprocessor.js @@ -0,0 +1,9 @@ +// preprocessor.js +var ReactTools = require('react-tools'); +var to5 = require('6to5-jest').process; + +module.exports = { + process: function(src, filename) { + return ReactTools.transform(to5(src, filename)); + } +}; \ No newline at end of file diff --git a/package.json b/package.json index 655c4e5..c218d1d 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,29 @@ { + "scripts": { + "test": "jest && mocha --compilers js:mocha-traceur __tests__/**/*.spec.js" + }, + "jest": { + "testFileExtensions": [ + "jest.js" + ], + "scriptPreprocessor": "/__tests__/preprocessor.js", + "unmockedModulePathPatterns": [ + "/node_modules/react" + ] + }, "private": true, "devDependencies": { + "babel": "^5.5.6", "gulp": "^3.8.8", - "laravel-elixir": "*" + "laravel-elixir": "*", + "mocha": "^2.2.5", + "mocha-sinon": "^1.1.4", + "sinon": "^1.14.1" }, "dependencies": { "bootstrap": "^3.3.4", "jquery": "^2.1.3", - "react": "^0.13.1" + "react": "^0.13.3", + "react-tools": "^0.13.3" } }