Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
travis unit testing
  • Loading branch information
robertkowalski committed Feb 3, 2017
1 parent e1a20f9 commit 93032ac
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .babelrc
@@ -0,0 +1,11 @@
{
"presets": [
["es2015", {"modules": false}]
],

"env": {
"test": {
"plugins": ["transform-es2015-modules-commonjs"]
}
}
}
5 changes: 5 additions & 0 deletions .npmignore
@@ -1,3 +1,8 @@
dev/
test/
node_modules/

.DS_Store
.travis.yml
webpack.config.js
.babelrc
3 changes: 3 additions & 0 deletions .travis.yml
@@ -0,0 +1,3 @@
language: node_js
node_js:
- "6"
15 changes: 15 additions & 0 deletions dev/test/unit/calendar.test.js
@@ -0,0 +1,15 @@
import Calendar from '../../js/calendar.js'

describe('calendar', () => {
it('returns a Calendar instance', () => {
expect(new Calendar('.blerg').selector).toBeTruthy()
})

it('renders', () => {
document.body.innerHTML = '<div class="blerg"></div>'
new Calendar('.blerg').render()

const el = document.querySelectorAll('.blerg')[0]
expect(el.innerHTML).toEqual('<div>I\'m a calendar!</div>')
})
})
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -4,7 +4,7 @@
"description": "no dependencies, no cry",
"main": "index.js",
"scripts": {
"test": "echo \"test\"",
"test": "jest",
"build": "webpack webpack.config.js",
"watch": "npm run build -- --watch",
"prepublish": "npm run test && echo \"Building...\" && npm run build"
Expand All @@ -31,6 +31,7 @@
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.22.0",
"css-loader": "^0.26.1",
"jest": "^18.1.0",
"mocha": "^3.2.0",
"style-loader": "^0.13.1",
"webpack": "^2.2.1"
Expand Down

0 comments on commit 93032ac

Please sign in to comment.