Skip to content

Commit

Permalink
Upgrade sinon to 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed May 8, 2018
1 parent 1b1b8d7 commit 1faac97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"mz": "^2.6.0",
"nyc": "^11.0.0",
"pkg-up": "^2.0.0",
"sinon": "^4.1.3",
"sinon": "^5.0.7",
"tempy": "^0.2.1"
},
"engines": {
Expand Down
34 changes: 13 additions & 21 deletions test/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ test('validateListFromOptions does not take non-Array/String values', t => {
})

test('validateListFromOptions works for armv7l host and target arch', t => {
const sandbox = sinon.createSandbox()

sandbox.stub(process, 'arch').value('arm')
sandbox.stub(process, 'config').value({variables: {arm_version: '7'}})
sinon.stub(process, 'arch').value('arm')
sinon.stub(process, 'config').value({variables: {arm_version: '7'}})

t.deepEqual(targets.validateListFromOptions({}, 'arch'), ['armv7l'])

sandbox.restore()
sinon.restore()
})

testMultiTarget('build for all available official targets', {all: true, electronVersion: '1.8.2'},
Expand Down Expand Up @@ -96,37 +94,31 @@ test('fails with invalid platform', util.invalidOptionTest({
}))

test('hostArch detects incorrectly configured armv7l Node', t => {
const sandbox = sinon.createSandbox()

sandbox.stub(targets, 'unameArch').returns('armv7l')
sandbox.stub(process, 'arch').value('arm')
sandbox.stub(process, 'config').value({variables: {arm_version: '6'}})
sinon.stub(targets, 'unameArch').returns('armv7l')
sinon.stub(process, 'arch').value('arm')
sinon.stub(process, 'config').value({variables: {arm_version: '6'}})

t.is(targets.hostArch(), 'armv7l')

sandbox.restore()
sinon.restore()
})

test('hostArch detects correctly configured armv7l Node', t => {
const sandbox = sinon.createSandbox()

sandbox.stub(process, 'arch').value('arm')
sandbox.stub(process, 'config').value({variables: {arm_version: '7'}})
sinon.stub(process, 'arch').value('arm')
sinon.stub(process, 'config').value({variables: {arm_version: '7'}})

t.is(targets.hostArch(), 'armv7l')

sandbox.restore()
sinon.restore()
})

test('hostArch cannot determine ARM version', t => {
const sandbox = sinon.createSandbox()

sandbox.stub(process, 'arch').value('arm')
sandbox.stub(process, 'config').value({variables: {arm_version: '99'}})
sinon.stub(process, 'arch').value('arm')
sinon.stub(process, 'config').value({variables: {arm_version: '99'}})

t.is(targets.hostArch(), 'arm')

sandbox.restore()
sinon.restore()
})

testMultiTarget('invalid official combination', {arch: 'ia32', platform: 'darwin'}, 0, 'Package should not be generated for invalid official combination')
Expand Down

0 comments on commit 1faac97

Please sign in to comment.