sipp11
9 years ago
commit
78b2c94f86
10 changed files with 143 additions and 0 deletions
@ -0,0 +1,4 @@
|
||||
node_modules/ |
||||
npm-debug.log |
||||
.DS_Store |
||||
bower_components |
@ -0,0 +1,15 @@
|
||||
|
||||
v1.1 / 2015-12-14 |
||||
================= |
||||
|
||||
* Support ES2015 & Stage 0 |
||||
|
||||
v1.0 / 2015-11-17 |
||||
================= |
||||
|
||||
* Add support info |
||||
* Fixed path to register.js |
||||
* Clear dependencies |
||||
* Add docs about install, test and license |
||||
* Support Babel.js in Jasmine specs |
||||
* Initial commit |
@ -0,0 +1,39 @@
|
||||
# test-jasmine-babel |
||||
|
||||
> Test project which use Babel.js as ES6 compiler to write unit tests |
||||
|
||||
## Setup |
||||
|
||||
``` |
||||
npm install |
||||
``` |
||||
|
||||
## Test |
||||
|
||||
Before you should have global installation of `jasmine` package. |
||||
|
||||
``` |
||||
npm test |
||||
``` |
||||
|
||||
## Support |
||||
|
||||
Current support version: |
||||
|
||||
- `Babel ^6.3.17` |
||||
|
||||
Previously support: |
||||
|
||||
- `Babel ^5.8.29` |
||||
|
||||
## Build changelog |
||||
|
||||
Use https://github.com/tj/git-extras/blob/master/Commands.md#git-changelog: |
||||
|
||||
``` |
||||
git changelog -a -n |
||||
``` |
||||
|
||||
## License |
||||
|
||||
[The MIT License](http://piecioshka.mit-license.org) |
@ -0,0 +1,13 @@
|
||||
export const INCREMENT_COUNTER = 'INCREMENT_COUNTER' |
||||
export const DECREMENT_COUNTER = 'DECREMENT_COUNTER' |
||||
|
||||
export default function counter(state = 0, action) { |
||||
switch (action.type) { |
||||
case INCREMENT_COUNTER: |
||||
return state + 1 |
||||
case DECREMENT_COUNTER: |
||||
return state - 1 |
||||
default: |
||||
return state |
||||
} |
||||
} |
@ -0,0 +1,7 @@
|
||||
class Foo { |
||||
static bar() { |
||||
return 'bar'; |
||||
} |
||||
} |
||||
|
||||
export default Foo; |
@ -0,0 +1,14 @@
|
||||
{ |
||||
"private": true, |
||||
"name": "test-jasmine-babel", |
||||
"scripts": { |
||||
"clear": "rm -rf node_modules/", |
||||
"test": "jasmine JASMINE_CONFIG_PATH=test/jasmine.json" |
||||
}, |
||||
"devDependencies": { |
||||
"babel-core": "^6.3.26", |
||||
"babel-preset-es2015": "^6.3.13", |
||||
"babel-preset-stage-0": "^6.3.13", |
||||
"jasmine": "^2.4.1" |
||||
} |
||||
} |
@ -0,0 +1,9 @@
|
||||
{ |
||||
"spec_dir": "test", |
||||
"spec_files": [ |
||||
"spec/test.*.es6.js" |
||||
], |
||||
"helpers": [ |
||||
"../node_modules/babel-core/register.js" |
||||
] |
||||
} |
@ -0,0 +1,29 @@
|
||||
import counter from '../../app/scripts/core/Counter.es6'; |
||||
|
||||
|
||||
describe('counter', () => { |
||||
it('should handle initial state', () => { |
||||
expect ( |
||||
counter(0, { type: 'INCREMENT_COUNTER' }) |
||||
).toEqual(1); |
||||
}); |
||||
|
||||
it('should handle INCREMENT_COUNTER', () => { |
||||
expect ( |
||||
counter(1, { type: 'INCREMENT_COUNTER' }) |
||||
).toEqual(2); |
||||
}); |
||||
|
||||
it('should handle DECREMENT_COUNTER', () => { |
||||
expect ( |
||||
counter(2, { type: 'DECREMENT_COUNTER' }) |
||||
).toEqual(1); |
||||
}); |
||||
|
||||
it('should handle unknown action type', () => { |
||||
expect ( |
||||
counter(1, { type: 'SOMETHING_ELSE' }) |
||||
).toEqual(1); |
||||
}); |
||||
}); |
||||
|
Loading…
Reference in new issue