1 | expect = require("chai").expect
|
2 | glob = require('glob')
|
3 |
|
4 | deprivation = require "../"
|
5 | chamber = deprivation.chamber
|
6 |
|
7 | describe "deprivation chamber for UT", ->
|
8 |
|
9 | it "exposes my interior", ->
|
10 | me = chamber("test/exampleUUT.js").whitebox()
|
11 | expect(me.arrangeHeapDumps).be.ok
|
12 | me.arrangeHeapDumps("kupadupa")
|
13 | me.module.exports.NoRefFunc()
|
14 |
|
15 | xit 'allows complete stubbing', ->
|
16 | seance = chamber("test/exampleUUT.js", replace:["./dep"], replacer: inquisitor.mockify)
|
17 | whitebox = seance.whitebox()
|
18 | blackbox = seance.blackbox()
|
19 | expect(whitebox.module.exports).to.be.not.equal(blackbox)
|
20 | expect(whitebox.module.exports.depInitialized).to.be.equal(undefined)
|
21 | expect(blackbox.depInitialized).to.be.equal(undefined)
|
22 |
|
23 | describe 'chamber for MT', ->
|
24 |
|
25 | it 'stubs (mocks shouldn\'t be called)', ->
|
26 | seance = chamber('test/exampleUUT.js', replace:['glob': {GlobSync: -> return 'jojojoa'}])
|
27 | me = seance.blackbox()
|
28 | expect(me.callGlobSync('łochocho')).to.be.equal('jojojoa')
|