Skip to content

Commit

Permalink
test(git): fix temp dir path
Browse files Browse the repository at this point in the history
  • Loading branch information
sisp committed Jul 26, 2024
1 parent 92412a8 commit 1f0ce9a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/util/git/private-key.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os from 'node:os';
import { any, mockDeep } from 'jest-mock-extended';
import upath from 'upath';
import { mockedExtended } from '../../../test/util';
import * as exec_ from '../exec';
import { configSigningKey, writePrivateKey } from './private-key';
Expand Down Expand Up @@ -26,7 +28,9 @@ describe('util/git/private-key', () => {
setPrivateKey('some-key');
exec.exec.calledWith(any()).mockResolvedValue({ stdout: '', stderr: '' });
exec.exec
.calledWith('gpg --import /tmp/git-private-gpg.key')
.calledWith(
`gpg --import ${upath.join(os.tmpdir() + '/git-private-gpg.key')}`,
)
.mockRejectedValueOnce({
stderr: `something wrong`,
stdout: '',
Expand All @@ -39,7 +43,9 @@ describe('util/git/private-key', () => {
const repoDir = '/tmp/some-repo';
exec.exec.calledWith(any()).mockResolvedValue({ stdout: '', stderr: '' });
exec.exec
.calledWith(`gpg --import /tmp/git-private-gpg.key`)
.calledWith(
`gpg --import ${upath.join(os.tmpdir() + '/git-private-gpg.key')}`,
)
.mockResolvedValueOnce({
stderr: `gpg: key ${publicKey}: secret key imported\nfoo\n`,
stdout: '',
Expand Down

0 comments on commit 1f0ce9a

Please sign in to comment.