Skip to content

Commit 3655105

Browse files
committed
Fixup tests
Other than the one required change (at the end), I've also removed the dependence of the current working directory being the repo's origin (which makes it possible to run just this one test directly in IDEs)
1 parent 13c98ef commit 3655105

File tree

1 file changed

+7
-10
lines changed
  • src/backend/wine/manager/downloader/__tests__/utilities

1 file changed

+7
-10
lines changed

src/backend/wine/manager/downloader/__tests__/utilities/unzip.test.ts

+7-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jest.mock('@xhmikosr/decompress-targz', () => {
1414
jest.mock('@felipecrs/decompress-tarxz', () => {
1515
return jest.fn().mockImplementation(() => {})
1616
})
17-
const workDir = process.cwd()
1817

1918
describe('Utilities - Unzip', () => {
2019
test('unzip file fails because of invalid archive path', async () => {
@@ -36,9 +35,7 @@ describe('Utilities - Unzip', () => {
3635
unzipDir: __dirname,
3736
onProgress: progress
3837
})
39-
).rejects.toStrictEqual(
40-
`Archive path ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities is not a file!`
41-
)
38+
).rejects.toStrictEqual(`Archive path ${__dirname} is not a file!`)
4239
})
4340

4441
test('unzip file fails because of invalid install path', async () => {
@@ -67,7 +64,7 @@ describe('Utilities - Unzip', () => {
6764
onProgress: progress
6865
})
6966
).resolves.toStrictEqual(
70-
`Succesfully unzip ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities/../test_data/test.tar.xz to ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities/test_unzip.`
67+
`Succesfully unzip ${__dirname}/../test_data/test.tar.xz to ${installDir}.`
7168
)
7269

7370
if (existsSync(installDir)) {
@@ -90,7 +87,7 @@ describe('Utilities - Unzip', () => {
9087
onProgress: progress
9188
})
9289
).resolves.toStrictEqual(
93-
`Succesfully unzip ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities/../test_data/test.tar.gz to ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities/test_unzip.`
90+
`Succesfully unzip ${__dirname}/../test_data/test.tar.gz to ${installDir}.`
9491
)
9592

9693
if (existsSync(installDir)) {
@@ -113,7 +110,7 @@ describe('Utilities - Unzip', () => {
113110
onProgress: progress
114111
})
115112
).resolves.toStrictEqual(
116-
`Succesfully unzip ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities/../test_data/test.tar.gz to ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities/test_unzip.`
113+
`Succesfully unzip ${__dirname}/../test_data/test.tar.gz to ${installDir}.`
117114
)
118115

119116
await expect(
@@ -124,14 +121,14 @@ describe('Utilities - Unzip', () => {
124121
onProgress: progress
125122
})
126123
).resolves.toStrictEqual(
127-
`Succesfully unzip ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities/../test_data/test.tar.gz to ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities/test_unzip.`
124+
`Succesfully unzip ${__dirname}/../test_data/test.tar.gz to ${installDir}.`
128125
)
129126

130127
if (existsSync(installDir)) {
131128
rmSync(installDir, { recursive: true })
132129
}
133130

134-
expect(progress).toBeCalledWith('unzipping')
135-
expect(progress).toBeCalledWith('idle')
131+
expect(progress).toBeCalledWith({ status: 'unzipping' })
132+
expect(progress).toBeCalledWith({ status: 'idle' })
136133
})
137134
})

0 commit comments

Comments
 (0)