Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeh committed Dec 9, 2018
1 parent 97c9982 commit 5b6dec6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
17 changes: 17 additions & 0 deletions test/lib/stats.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const is = require('@magic/types')

const stats = require('../../src/lib/stats')

const t = {
fn: () => true,
expect: true,
info: 'true is true',
key: 'testing',
}

module.exports = [
{ fn: () => stats, expect: is.obj, info: 'stats exports a function' },
{ fn: () => stats.info, expect: is.fn, info: 'stats exports a function' },
{ fn: () => stats.reset, expect: is.fn, info: 'stats exports a function' },
{ fn: () => stats.test, expect: is.fn, info: 'stats exports a function' },
]
19 changes: 9 additions & 10 deletions test/lib/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ const store = require('../../src/lib/store')
const before = () => () => store.set({ key: undefined })

module.exports = [
{ fn: () => store.set, expect: is.fn },
{ fn: () => store.get, expect: is.fn },
{ fn: () => store.get('suites'), expect: is.obj },
{ fn: () => store.get('module'), expect: '@magic/test' },
{ fn: () => store.get('stats'), expect: is.obj },
{ fn: () => store.set, expect: is.fn, info: 'store.set is a function' },
{ fn: () => store.get, expect: is.fn, info: 'store.get is a function' },
{ fn: () => store.state, expect: is.obj, info: 'store.state is an objectn' },
{ fn: () => store.get('suites'), expect: is.obj, info: 'suites are collected in an object' },
{ fn: () => store.get('module'), expect: '@magic/test', info: 'module @magic/test exists' },
{ fn: () => store.get('stats'), expect: is.obj, info: 'stats are collected in an object' },
{
fn: () => store.set({ key: 'value' }),
expect: () => store.get('key') === 'value',
before,
},
{
fn: () => store.get('key'),
expect: undefined,
},
]
{ fn: () => store.get('key2'), expect: is.undefined, before, info: 'store.get(key) returns undefined' },
{ fn: () => store.get(), expect: is.object, info: 'store.get() returns object' },
]
14 changes: 0 additions & 14 deletions test/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,3 @@ module.exports = [
{ fn: () => test.vals, expect: is.obj },
{ fn: () => test.version, expect: is.obj },
]

// module.exports = Object.assign(run, {
// run,
// curry: require('./lib/curry'),
// is: require('@magic/types'),
// isNodeProd,
// isProd,
// log: require('@magic/log'),
// mock: require('./mock'),
// promise: require('./lib/promise'),
// store: require('./store'),
// vals: require('./vals'),
// version: require('./version'),
// })

0 comments on commit 5b6dec6

Please sign in to comment.