Skip to content

Commit

Permalink
fix: Fix rest of the snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
janjakubnanista committed Feb 9, 2024
1 parent bdadbab commit a651a10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 7 additions & 5 deletions tests/ua-devtools-evm-hardhat-test/test/task/oapp/wire.test.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit a651a10

Please sign in to comment.