From 3655105eb24e1559089c4cf563196de735c98210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathis=20Dr=C3=B6ge?= Date: Thu, 11 Jan 2024 13:11:57 +0100 Subject: [PATCH] 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) --- .../__tests__/utilities/unzip.test.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/backend/wine/manager/downloader/__tests__/utilities/unzip.test.ts b/src/backend/wine/manager/downloader/__tests__/utilities/unzip.test.ts index c8bbf4b749..31e439767e 100644 --- a/src/backend/wine/manager/downloader/__tests__/utilities/unzip.test.ts +++ b/src/backend/wine/manager/downloader/__tests__/utilities/unzip.test.ts @@ -14,7 +14,6 @@ jest.mock('@xhmikosr/decompress-targz', () => { jest.mock('@felipecrs/decompress-tarxz', () => { return jest.fn().mockImplementation(() => {}) }) -const workDir = process.cwd() describe('Utilities - Unzip', () => { test('unzip file fails because of invalid archive path', async () => { @@ -36,9 +35,7 @@ describe('Utilities - Unzip', () => { unzipDir: __dirname, onProgress: progress }) - ).rejects.toStrictEqual( - `Archive path ${workDir}/src/backend/wine/manager/downloader/__tests__/utilities is not a file!` - ) + ).rejects.toStrictEqual(`Archive path ${__dirname} is not a file!`) }) test('unzip file fails because of invalid install path', async () => { @@ -67,7 +64,7 @@ describe('Utilities - Unzip', () => { onProgress: progress }) ).resolves.toStrictEqual( - `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.` + `Succesfully unzip ${__dirname}/../test_data/test.tar.xz to ${installDir}.` ) if (existsSync(installDir)) { @@ -90,7 +87,7 @@ describe('Utilities - Unzip', () => { onProgress: progress }) ).resolves.toStrictEqual( - `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.` + `Succesfully unzip ${__dirname}/../test_data/test.tar.gz to ${installDir}.` ) if (existsSync(installDir)) { @@ -113,7 +110,7 @@ describe('Utilities - Unzip', () => { onProgress: progress }) ).resolves.toStrictEqual( - `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.` + `Succesfully unzip ${__dirname}/../test_data/test.tar.gz to ${installDir}.` ) await expect( @@ -124,14 +121,14 @@ describe('Utilities - Unzip', () => { onProgress: progress }) ).resolves.toStrictEqual( - `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.` + `Succesfully unzip ${__dirname}/../test_data/test.tar.gz to ${installDir}.` ) if (existsSync(installDir)) { rmSync(installDir, { recursive: true }) } - expect(progress).toBeCalledWith('unzipping') - expect(progress).toBeCalledWith('idle') + expect(progress).toBeCalledWith({ status: 'unzipping' }) + expect(progress).toBeCalledWith({ status: 'idle' }) }) })