Skip to content

Commit 3b9da43

Browse files
committed
revamped test to mock inConfig and inHome
1 parent c0f7e87 commit 3b9da43

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/profile/index.test.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
const test = require('ava')
33
const sinon = require('sinon')
4-
const os = require('os')
54
const Profile = require('../../src/profile')
65

76
test.beforeEach((t) => {
@@ -15,7 +14,8 @@ test.beforeEach((t) => {
1514
record: sinon.stub(),
1615
keys: {}
1716
}
18-
sinon.stub(os, 'homedir').returns('')
17+
Profile.prototype.inHome = (...args) => args.pop()
18+
Profile.prototype.inConfig = (...args) => args.pop()
1919
t.context.profile = new Profile({ config, runlog })
2020
})
2121

@@ -27,16 +27,15 @@ test('writes to all shell and power profiles for system with all shells and powe
2727
detectedShellFormatProfiles,
2828
detectedPowerFormatProfiles
2929
} = await profile._detectProfiles()
30-
t.deepEqual(detectedShellFormatProfiles, [
30+
t.deepEqual([
3131
'.profile',
3232
'.kshrc',
3333
'.zshrc',
3434
'.zprofile',
3535
'.bashrc',
3636
'.bash_profile'
37-
])
38-
t.deepEqual(detectedPowerFormatProfiles, [
39-
'.config/powershell/Microsoft.PowerShell_profile.ps1',
40-
'Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1'
41-
])
37+
], detectedShellFormatProfiles)
38+
t.deepEqual([
39+
'Microsoft.PowerShell_profile.ps1'
40+
], detectedPowerFormatProfiles)
4241
})

0 commit comments

Comments
 (0)