Skip to content

Commit

Permalink
fix: killing tor process tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EmiM committed Jan 25, 2024
1 parent 11b674b commit f358ae7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/backend/src/nest/tor/tor.service.tor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,19 @@ describe('TorControl', () => {
expect(status).toBe(false)
})

it('should find hanging tor process and kill it', async () => {
it('should find hanging tor processes and kill them', async () => {
const processKill = jest.spyOn(process, 'kill')
await torService.init()
torService.clearHangingTorProcess()
expect(processKill).toHaveBeenCalledTimes(1)
expect(processKill).toHaveBeenCalledTimes(2) // Spawning with {shell:true} starts 2 processes so we need to kill 2 processes
})

it('should find hanging tor process and kill it if Quiet path includes space', async () => {
it('should find hanging tor processes and kill them if Quiet path includes space', async () => {
tmpDir = createTmpDir('quietTest Tmp_') // On MacOS quiet data lands in '(...)/Application Support/(...)' which caused problems with grep
tmpAppDataPath = tmpQuietDirPath(tmpDir.name)
const processKill = jest.spyOn(process, 'kill')
await torService.init()
torService.clearHangingTorProcess()
expect(processKill).toHaveBeenCalledTimes(1)
expect(processKill).toHaveBeenCalledTimes(2) // Spawning with {shell:true} starts 2 processes so we need to kill 2 processes
})
})

0 comments on commit f358ae7

Please sign in to comment.