Skip to content

Commit

Permalink
move another test to Mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jun 24, 2017
1 parent ac336b6 commit 4e95987
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
20 changes: 20 additions & 0 deletions test/as-parent-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const chdir = require('chdir-promise')
const nextUpdate = require('..')
const execa = require('execa')
const snapShot = require('snap-shot')
const _ = require('lodash')
const is = require('check-more-types')
const la = require('lazy-ass')
const TWO_MINUTES = 120000

const testFolder = path.join(__dirname, 'test-next-updater')
Expand All @@ -26,6 +29,23 @@ describe('testing check-types', () => {

afterEach(chdir.back)

it('checks latest check-types', function () {
this.timeout(TWO_MINUTES)
const opts = {
module: 'check-types',
latest: true
}
const removeVersions = (results) => results.map(r => {
la(is.semver(r.version), 'expected version', r)
r.version = 'valid'
return r
})
return snapShot(nextUpdate(opts)
.then(_.flatten)
.then(removeVersions)
)
})

it('checks some versions of check-types', function () {
this.timeout(TWO_MINUTES)

Expand Down
21 changes: 1 addition & 20 deletions test/as-parent.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,8 @@ nextUpdate = require '..'
gt.test 'basics', ->
gt.func nextUpdate, 'next update is a function'

gt.async 'check latest only updating', ->
opts =
module: 'check-types'
latest: true
promise = nextUpdate(opts)
gt.ok q.isPromise(promise), 'next update returns a promise'
promise.then -> console.log 'everything is ok'
promise.catch -> gt.ok false, 'promise failed'
promise.finally -> gt.start()
, TWO_MINUTES

# [ [ { name: 'check-types', version: '1.1.1', works: false } ] ]
# TODO use schem-shot
gt.async 'results format', ->
opts =
module: 'check-types'
Expand All @@ -44,12 +34,3 @@ gt.async 'results format', ->
promise.catch -> gt.ok false, 'promise failed'
promise.finally -> gt.start()
, TWO_MINUTES

# gt.async 'check all', ->
# opts =
# module: 'check-types'
# promise = nextUpdate(opts)
# promise.then -> gt.ok true, 'everything is ok'
# promise.catch -> gt.ok false, 'promise failed'
# promise.finally -> gt.start()
# , TWO_MINUTES
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ exports['checks some versions of check-types 1'] = [
]
]

exports['checks latest check-types 1'] = [
{
"name": "check-types",
"version": "valid",
"from": "0.6.5",
"works": false
}
]

0 comments on commit 4e95987

Please sign in to comment.