Skip to content

Commit

Permalink
chore: all unit tests are using Jest
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Mar 29, 2018
1 parent 7b2b777 commit 1e26cd0
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 102 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ before_install:
before_script:
- npm prune
script:
- npm run jest
- npm test
after_success:
- npm run semantic-release
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
"scripts": {
"test": "npm run itself && npm run unit && npm run e2e",
"itself": "node index.js",
"unit": "gt src/test/**/*.coffee --output",
"jest": "jest",
"unit": "jest",
"e2e": "gt test/*.coffee --output",
"commit": "git-issues && commit-wizard",
"issues": "git-issues",
Expand Down
24 changes: 24 additions & 0 deletions src/__tests__/bower-test-with-deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const join = require('path').join
const exists = require('fs').existsSync
const check = require('../check-bower-file')

const testFolder = join(__dirname, 'bower-test-with-deps')
const bowerFilename = join(testFolder, 'bower.json')

describe('running as parent tests', () => {
beforeEach(() => {
process.chdir(testFolder)
})
afterEach(() => {
process.chdir(__dirname)
})

it('check function', () => {
expect(typeof check).toBe('function')
expect(exists(bowerFilename)).toBe(true)
})

it('test itself via check', () => {
expect(check(testFolder, bowerFilename, true)).toBe(true)
})
})
File renamed without changes.
24 changes: 24 additions & 0 deletions src/__tests__/bower-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const join = require('path').join
const exists = require('fs').existsSync
const check = require('../check-bower-file')

const testFolder = join(__dirname, 'bower-test')
const bowerFilename = join(testFolder, 'bower.json')

describe('running as parent tests', () => {
beforeEach(() => {
process.chdir(testFolder)
})
afterEach(() => {
process.chdir(__dirname)
})

it('check function', () => {
expect(typeof check).toBe('function')
expect(exists(bowerFilename)).toBe(true)
})

it('detects that dependencies are not installed', () => {
expect(check(testFolder, bowerFilename, true)).toBe(false)
})
})
File renamed without changes.
17 changes: 17 additions & 0 deletions src/__tests__/supported-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const isSupported = require('../is-supported-version-format')

describe('is supported version format', () => {
it('regular versions', () => {
expect(isSupported('0.2.0')).toBe(true)
expect(isSupported('^0.2.0')).toBe(true)
expect(isSupported('~0.2.0')).toBe(true)
})

it('unsupported urls', () => {
expect(isSupported('http://somewhere/repo')).toBe(false)
expect(isSupported('git@github.com:bahmutov/angular-minicolors.git')).toBe(false)
expect(isSupported('git://gh.com/foo/bar#30030')).toBe(false)
expect(isSupported('github:jstrace/bars')).toBe(false)
expect(isSupported('file:./dummy')).toBe(false)
})
})
3 changes: 0 additions & 3 deletions src/test/bower-non-standard-test/.bowerrc

This file was deleted.

12 changes: 0 additions & 12 deletions src/test/bower-non-standard-test/bower.json

This file was deleted.

16 changes: 0 additions & 16 deletions src/test/bower-test-with-deps.coffee

This file was deleted.

33 changes: 0 additions & 33 deletions src/test/bower-test-with-deps/bower_components/lodash/.bower.json

This file was deleted.

20 changes: 0 additions & 20 deletions src/test/bower-test.coffee

This file was deleted.

15 changes: 0 additions & 15 deletions src/test/supported-version.coffee

This file was deleted.

0 comments on commit 1e26cd0

Please sign in to comment.