Skip to content

Instantly share code, notes, and snippets.

@websoftwares
Created October 26, 2017 08:26
Show Gist options
  • Save websoftwares/2b961665eb958acc427a9ed69408549b to your computer and use it in GitHub Desktop.
Save websoftwares/2b961665eb958acc427a9ed69408549b to your computer and use it in GitHub Desktop.
webtask-simple-function-model-test
module.exports = function (cb) {
cb(null, { i_am: 'done ' })
}
'use strict'
const tape = require('tape')
const simpleFunction = require('./simple-function')
const cbSpy = (t, expected) => (error, actual) => {
t.equal(null, error, `Assert expected: null matches actual: ${error}`)
t.deepEqual(
expected,
actual,
`Assert expected: ${JSON.stringify(expected)} matches actual: ${JSON.stringify(actual)}`
)
}
tape('Simple function test cases', (t) => {
const exptected = { i_am: 'done ' }
simpleFunction(cbSpy(t, exptected))
t.end()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment