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

Commit

Permalink
jasmine → mocha+expect
Browse files Browse the repository at this point in the history
  • Loading branch information
mov37 committed Jun 19, 2016
1 parent f5424e9 commit 1397155
Show file tree
Hide file tree
Showing 21 changed files with 693 additions and 613 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
docs/
test/
.eslintrc
.gitignore
.travis.yml
Gruntfile.js
karma.conf.js
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# is.js ![version](https://img.shields.io/npm/v/@pwn/is.svg?style=flat-square) ![build status](https://img.shields.io/travis/pwnn/is.js.svg?style=flat-square)
# is.js

![build status](https://saucelabs.com/browser-matrix/pwn-isjs.svg)
![version](https://img.shields.io/npm/v/@pwn/is.svg?style=flat-square)
![build status](https://img.shields.io/travis/pwnn/is.js.svg?style=flat-square)

![saucelabs matrix](https://saucelabs.com/browser-matrix/pwn-isjs.svg)

Minimalistic predicate library.

Expand Down
2 changes: 0 additions & 2 deletions config/.eslintrc

This file was deleted.

4 changes: 0 additions & 4 deletions config/karma.base.js

This file was deleted.

3 changes: 0 additions & 3 deletions config/karma.local.js

This file was deleted.

109 changes: 0 additions & 109 deletions config/karma.sauceLabs.js

This file was deleted.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
"repository": "https://github.com/pwnn/is.js",
"scripts": {
"build": "grunt && docco lib/is.js",
"test": "karma start config/karma.sauceLabs.js"
"test": "jasmine JASMINE_CONFIG_PATH=test/config/jasmine.json && karma start test/config/karma.sauce.js",
"test:dev": "jasmine JASMINE_CONFIG_PATH=test/config/jasmine.json && karma start test/config/karma.local.js"
},
"devDependencies": {
"docco": "~0.7.0",
"eslint": "~2.10.2",
"eslint-config-pwn-es5": "~3.1.0",
"expect": "~1.20.1",
"grunt": "~1.0.1",
"grunt-contrib-uglify": "~1.0.1",
"jasmine": "~2.4.1",
"js-yaml": "~3.6.1",
"karma": "~0.13.22",
"karma-expect": "~1.1.2",
"karma-mocha": "~1.0.1",
"karma-jasmine": "~1.0.2",
"karma-sauce-launcher": "~1.0.0",
"load-grunt-tasks": "~3.5.0",
"mocha": "~2.5.2"
"load-grunt-tasks": "~3.5.0"
}
}
1 change: 1 addition & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
env:
browser: true
es6: true
mocha: true
globals:
is: true
Expand Down
44 changes: 22 additions & 22 deletions test/array.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
describe( 'bundle:array' , function () {

it( 'is.array' , function () {
expect( is.array( [] ) ).to.be.ok() // ←
expect( is.array( '' ) ).to.not.be.ok()
expect( is.array( document.scripts ) ).to.not.be.ok()
expect( is.array( function () {} ) ).to.not.be.ok()
expect( is.array( [] ) ).toBeTruthy() // ←
expect( is.array( '' ) ).not.toBeTruthy()
expect( is.array( { length : 0 } ) ).not.toBeTruthy()
expect( is.array( function () {} ) ).not.toBeTruthy()
} )

it( 'is.arrayLikeObject' , function () {

expect( is.arrayLikeObject( [] ) ).to.be.ok()
expect( is.arrayLikeObject( '' ) ).to.not.be.ok()
expect( is.arrayLikeObject( document.scripts ) ).to.be.ok()
expect( is.arrayLikeObject( function () {} ) ).to.not.be.ok()
expect( is.arrayLikeObject( [] ) ).toBeTruthy()
expect( is.arrayLikeObject( '' ) ).not.toBeTruthy()
expect( is.arrayLikeObject( { length : 0 } ) ).toBeTruthy()
expect( is.arrayLikeObject( function () {} ) ).not.toBeTruthy()

expect( is.arrayLikeObject( { length : 'one' } ) ).to.not.be.ok()
expect( is.arrayLikeObject( { length : 3.14 } ) ).to.not.be.ok()
expect( is.arrayLikeObject( { length : -1 } ) ).to.not.be.ok()
expect( is.arrayLikeObject( { length : Math.pow( 2 , 53 ) } ) ).to.not.be.ok()
expect( is.arrayLikeObject( { length : 'one' } ) ).not.toBeTruthy()
expect( is.arrayLikeObject( { length : 3.14 } ) ).not.toBeTruthy()
expect( is.arrayLikeObject( { length : -1 } ) ).not.toBeTruthy()
expect( is.arrayLikeObject( { length : Math.pow( 2 , 53 ) } ) ).not.toBeTruthy()

} )

it( 'is.inArray' , function () {

expect( is.inArray( 0 , 0 ) ).to.not.be.ok()
expect( is.inArray( 0 , 0 ) ).not.toBeTruthy()

// offset out of range
expect( is.inArray( 0 , [ 1 ] , 1 ) ).to.not.be.ok()
expect( is.inArray( 0 , [ 1 ] , -2 ) ).to.not.be.ok()
expect( is.inArray( 0 , [ 1 ] , 1 ) ).not.toBeTruthy()
expect( is.inArray( 0 , [ 1 ] , -2 ) ).not.toBeTruthy()

expect( is.inArray( 2 , [ 1 , 2 , 3 ] ) ).to.be.ok()
expect( is.inArray( 4 , [ 1 , 2 , 3 ] ) ).to.not.be.ok()
expect( is.inArray( 2 , [ 1 , 2 , 3 ] , 1 ) ).to.be.ok()
expect( is.inArray( 2 , [ 1 , 2 , 3 ] , 2 ) ).to.not.be.ok()
expect( is.inArray( 2 , [ 1 , 2 , 3 ] , -2 ) ).to.be.ok()
expect( is.inArray( 2 , [ 1 , 2 , 3 ] ) ).toBeTruthy()
expect( is.inArray( 4 , [ 1 , 2 , 3 ] ) ).not.toBeTruthy()
expect( is.inArray( 2 , [ 1 , 2 , 3 ] , 1 ) ).toBeTruthy()
expect( is.inArray( 2 , [ 1 , 2 , 3 ] , 2 ) ).not.toBeTruthy()
expect( is.inArray( 2 , [ 1 , 2 , 3 ] , -2 ) ).toBeTruthy()

expect( is.inArray( [ 2 ] , [ 1 , [ 2 ] , 3 ] , 0 , is.deepEqual ) ).to.be.ok()
expect( is.inArray( [ 2 ] , [ 1 , [ 2 ] , 3 ] , is.deepEqual ) ).to.be.ok() // shortcut
expect( is.inArray( [ 2 ] , [ 1 , [ 2 ] , 3 ] , 0 , is.deepEqual ) ).toBeTruthy()
expect( is.inArray( [ 2 ] , [ 1 , [ 2 ] , 3 ] , is.deepEqual ) ).toBeTruthy() // shortcut

} )

Expand Down
12 changes: 6 additions & 6 deletions test/boolean.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
describe( 'bundle:boolean' , function () {

it( 'is.boolean' , function () {
expect( is.boolean( 1 ) ).to.not.be.ok()
expect( is.boolean( 0 ) ).to.not.be.ok()
expect( is.boolean( true ) ).to.be.ok() // ←
expect( is.boolean( false ) ).to.be.ok() // ←
expect( is.boolean( new Boolean( true ) ) ).to.not.be.ok()
expect( is.boolean( new Boolean( false ) ) ).to.not.be.ok()
expect( is.boolean( 1 ) ).not.toBeTruthy()
expect( is.boolean( 0 ) ).not.toBeTruthy()
expect( is.boolean( true ) ).toBeTruthy() // ←
expect( is.boolean( false ) ).toBeTruthy() // ←
expect( is.boolean( new Boolean( true ) ) ).not.toBeTruthy()
expect( is.boolean( new Boolean( false ) ) ).not.toBeTruthy()
} )

} )
Loading

0 comments on commit 1397155

Please sign in to comment.