From a651a1089567e73281464553d3ddae73cdc09fab Mon Sep 17 00:00:00 2001 From: Jan Nanista Date: Fri, 9 Feb 2024 12:01:56 -0800 Subject: [PATCH] fix: Fix rest of the snapshots --- .../test/task/oapp/__snapshots__/wire.test.ts.snap | 4 ++-- .../test/task/oapp/wire.test.ts | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/ua-devtools-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap b/tests/ua-devtools-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap index 5ea77d17d..162dc94ac 100644 --- a/tests/ua-devtools-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap +++ b/tests/ua-devtools-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap @@ -2,9 +2,9 @@ exports[`task lz:oapp:wire with invalid configs should fail if the config file does not exist 1`] = `[Error: Unable to read config file './does-not-exist.js'. Check that the file exists and is readable to your terminal user]`; -exports[`task lz:oapp:wire with invalid configs should fail if the config file is not a file 1`] = `[Error: Unable to read config file '/Users/jan/Workspace/devtools/tests/ua-devtools-evm-hardhat-test/test/task/oapp'. Check that the file exists and is readable to your terminal user]`; +exports[`task lz:oapp:wire with invalid configs should fail if the config file is not a file 1`] = `[Error: Unable to read config file 'test/task/oapp/__data__/configs'. Check that the file exists and is readable to your terminal user]`; -exports[`task lz:oapp:wire with invalid configs should fail if the config file is not a valid JSON or JS file 1`] = `[Error: Unable to read config file '/Users/jan/Workspace/devtools/tests/ua-devtools-evm-hardhat-test/README.md': SyntaxError: Unexpected token '<']`; +exports[`task lz:oapp:wire with invalid configs should fail if the config file is not a valid JSON or JS file 1`] = `[Error: Unable to read config file 'README.md': SyntaxError: Unexpected token '<']`; exports[`task lz:oapp:wire with invalid configs should fail with a malformed JS file (001) 1`] = ` [Error: Config from file 'test/task/oapp/__data__/configs/invalid.config.001.js' is malformed. Please fix the following errors: diff --git a/tests/ua-devtools-evm-hardhat-test/test/task/oapp/wire.test.ts b/tests/ua-devtools-evm-hardhat-test/test/task/oapp/wire.test.ts index cc25356d1..0255b44ae 100644 --- a/tests/ua-devtools-evm-hardhat-test/test/task/oapp/wire.test.ts +++ b/tests/ua-devtools-evm-hardhat-test/test/task/oapp/wire.test.ts @@ -1,6 +1,6 @@ import hre from 'hardhat' import { isFile, promptToContinue } from '@layerzerolabs/io-devtools' -import { join, relative, resolve } from 'path' +import { dirname, join, relative, resolve } from 'path' import { TASK_LZ_OAPP_WIRE } from '@layerzerolabs/ua-devtools-evm-hardhat' import { deployOApp } from '../../__utils__/oapp' import { cwd } from 'process' @@ -52,15 +52,17 @@ describe(`task ${TASK_LZ_OAPP_WIRE}`, () => { }) it('should fail if the config file is not a file', async () => { - await expect(hre.run(TASK_LZ_OAPP_WIRE, { oappConfig: __dirname })).rejects.toMatchSnapshot() + const oappConfig = dirname(configPathFixture('invalid.config.empty.json')) + + await expect(hre.run(TASK_LZ_OAPP_WIRE, { oappConfig })).rejects.toMatchSnapshot() }) it('should fail if the config file is not a valid JSON or JS file', async () => { - const readme = join(__dirname, '..', '..', '..', 'README.md') + const oappConfig = 'README.md' - expect(isFile(readme)).toBeTruthy() + expect(isFile(oappConfig)).toBeTruthy() - await expect(hre.run(TASK_LZ_OAPP_WIRE, { oappConfig: readme })).rejects.toMatchSnapshot() + await expect(hre.run(TASK_LZ_OAPP_WIRE, { oappConfig })).rejects.toMatchSnapshot() }) it('should fail with an empty JSON file', async () => {