Skip to content

Commit

Permalink
Step 3: write the first failing test
Browse files Browse the repository at this point in the history
This uses real Double, Call values and also the
actual CallLog. These are not application logic 
from the perspective of verify(), simply the place 
it gets its data from (as opposed to an argument, 
which is more typical).
  • Loading branch information
searls committed Dec 23, 2017
1 parent aae0ea6 commit 66389cb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/unit/verify/index.test.js
@@ -1,4 +1,8 @@
let subject, ensureDemonstration, didCallOccur, notifySatisfiedMatchers,
import Double from '../../../src/value/double'
import Call from '../../../src/value/call'
import CallLog from '../../../src/value/call-log'

let subject, ensureDemonstration, didCallOccur, notifySatisfiedMatchers,
warnIfAlsoStubbed, fail
module.exports = {
beforeEach: () => {
Expand All @@ -10,6 +14,18 @@ module.exports = {
subject = require('../../../src/verify/index').default
},
'verified to have occurred as configured': () => {
const double = new Double()
const call = new Call()
CallLog.instance.log(double, call)
const config = {some: 'option'}
td.when(didCallOccur(double, call, config)).thenReturn(true)

subject(/*imagine double('a','b','c')*/ undefined, config)

td.verify(ensureDemonstration(call))
td.verify(notifySatisfiedMatchers(double, call, config))
td.verify(warnIfAlsoStubbed(double, call, config))
assert.equal(td.explain(fail).callCount, 0)
},
'demonstrated call DID NOT occur, failing test': () => {
},
Expand Down

0 comments on commit 66389cb

Please sign in to comment.