diff --git a/README.md b/README.md index aa53c2deb..4fef8435a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ The code is arranged into: - **Reusable packages** under `./packages` directory - **Example projects** under `./examples` directory +- **Test projects & helpers** under `./tests` directory ## Development diff --git a/docker-compose.yaml b/docker-compose.yaml index 71d121997..1135a62c0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -56,6 +56,7 @@ services: volumes: - ./node_modules/.cache/turbo:/app/node_modules/.cache/turbo - ./packages:/app/packages + - ./tests:/app/tests # Hardhat has an issue with caching compilers inside a docker container, # failing with EACCES -13 error, pointing to a permissions issue with the cache folder. # diff --git a/package.json b/package.json index 335f93260..2a26f574d 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "private": true, "workspaces": [ "examples/*", - "packages/*" + "packages/*", + "tests/*" ], "scripts": { "build": "npx turbo run build", diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap b/packages/ua-utils-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap deleted file mode 100644 index 1761a1318..000000000 --- a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`task/oapp/wire with invalid configs should fail if the config file does not exist 1`] = `[Error: Unable to read config file '/app/packages/ua-utils-evm-hardhat-test/does-not-exist.js'. Check that the file exists and is readable to your terminal user]`; - -exports[`task/oapp/wire with invalid configs should fail if the config file is not a file 1`] = `[Error: Unable to read config file '/app/packages/ua-utils-evm-hardhat-test/test/task/oapp'. Check that the file exists and is readable to your terminal user]`; - -exports[`task/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 '/app/packages/ua-utils-evm-hardhat-test/README.md': SyntaxError: Unexpected token '<']`; - -exports[`task/oapp/wire with invalid configs should fail with a malformed JS file (001) 1`] = ` -[Error: Config from file '/app/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.001.js' is malformed. Please fix the following errors: - -Property 'contracts.0.contract': Invalid input -Property 'contracts.1.contract': Invalid input -Property 'connections': Required] -`; - -exports[`task/oapp/wire with invalid configs should fail with a misconfigured file (001) 1`] = `[Error: Config from file '/app/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.misconfigured.001.js' is invalid: AssertionError [ERR_ASSERTION]: Could not find a deployment for contract 'NonExistent']`; - -exports[`task/oapp/wire with invalid configs should fail with an empty JS file 1`] = ` -[Error: Config from file '/app/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.js' is malformed. Please fix the following errors: - -Property 'contracts': Required -Property 'connections': Required] -`; - -exports[`task/oapp/wire with invalid configs should fail with an empty JSON file 1`] = `[Error: Unable to read config file '/app/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.json': SyntaxError: Unexpected end of JSON input]`; diff --git a/packages/test-evm-node/hardhat.config.ts b/tests/test-evm-node/hardhat.config.ts similarity index 100% rename from packages/test-evm-node/hardhat.config.ts rename to tests/test-evm-node/hardhat.config.ts diff --git a/packages/test-evm-node/package.json b/tests/test-evm-node/package.json similarity index 100% rename from packages/test-evm-node/package.json rename to tests/test-evm-node/package.json diff --git a/packages/test-evm-node/tsconfig.json b/tests/test-evm-node/tsconfig.json similarity index 100% rename from packages/test-evm-node/tsconfig.json rename to tests/test-evm-node/tsconfig.json diff --git a/packages/test-utils/README.md b/tests/test-utils/README.md similarity index 100% rename from packages/test-utils/README.md rename to tests/test-utils/README.md diff --git a/packages/test-utils/package.json b/tests/test-utils/package.json similarity index 100% rename from packages/test-utils/package.json rename to tests/test-utils/package.json diff --git a/packages/test-utils/src/arbitraries.ts b/tests/test-utils/src/arbitraries.ts similarity index 100% rename from packages/test-utils/src/arbitraries.ts rename to tests/test-utils/src/arbitraries.ts diff --git a/packages/test-utils/src/constants.ts b/tests/test-utils/src/constants.ts similarity index 100% rename from packages/test-utils/src/constants.ts rename to tests/test-utils/src/constants.ts diff --git a/packages/test-utils/src/index.ts b/tests/test-utils/src/index.ts similarity index 100% rename from packages/test-utils/src/index.ts rename to tests/test-utils/src/index.ts diff --git a/packages/test-utils/tsconfig.json b/tests/test-utils/tsconfig.json similarity index 100% rename from packages/test-utils/tsconfig.json rename to tests/test-utils/tsconfig.json diff --git a/packages/test-utils/tsup.config.ts b/tests/test-utils/tsup.config.ts similarity index 100% rename from packages/test-utils/tsup.config.ts rename to tests/test-utils/tsup.config.ts diff --git a/packages/ua-utils-evm-hardhat-test/.eslintignore b/tests/ua-utils-evm-hardhat-test/.eslintignore similarity index 100% rename from packages/ua-utils-evm-hardhat-test/.eslintignore rename to tests/ua-utils-evm-hardhat-test/.eslintignore diff --git a/packages/ua-utils-evm-hardhat-test/.gitignore b/tests/ua-utils-evm-hardhat-test/.gitignore similarity index 100% rename from packages/ua-utils-evm-hardhat-test/.gitignore rename to tests/ua-utils-evm-hardhat-test/.gitignore diff --git a/packages/ua-utils-evm-hardhat-test/.prettierignore b/tests/ua-utils-evm-hardhat-test/.prettierignore similarity index 100% rename from packages/ua-utils-evm-hardhat-test/.prettierignore rename to tests/ua-utils-evm-hardhat-test/.prettierignore diff --git a/packages/ua-utils-evm-hardhat-test/README.md b/tests/ua-utils-evm-hardhat-test/README.md similarity index 100% rename from packages/ua-utils-evm-hardhat-test/README.md rename to tests/ua-utils-evm-hardhat-test/README.md diff --git a/packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol b/tests/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol similarity index 100% rename from packages/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol rename to tests/ua-utils-evm-hardhat-test/contracts/DefaultOApp.sol diff --git a/packages/ua-utils-evm-hardhat-test/contracts/OmniCounter.sol b/tests/ua-utils-evm-hardhat-test/contracts/OmniCounter.sol similarity index 100% rename from packages/ua-utils-evm-hardhat-test/contracts/OmniCounter.sol rename to tests/ua-utils-evm-hardhat-test/contracts/OmniCounter.sol diff --git a/packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts b/tests/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts rename to tests/ua-utils-evm-hardhat-test/deploy/001_bootstrap.ts diff --git a/packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts b/tests/ua-utils-evm-hardhat-test/deploy/002_oapp.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/deploy/002_oapp.ts rename to tests/ua-utils-evm-hardhat-test/deploy/002_oapp.ts diff --git a/packages/ua-utils-evm-hardhat-test/deploy/003_omnicounter.ts b/tests/ua-utils-evm-hardhat-test/deploy/003_omnicounter.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/deploy/003_omnicounter.ts rename to tests/ua-utils-evm-hardhat-test/deploy/003_omnicounter.ts diff --git a/packages/ua-utils-evm-hardhat-test/hardhat.config.ts b/tests/ua-utils-evm-hardhat-test/hardhat.config.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/hardhat.config.ts rename to tests/ua-utils-evm-hardhat-test/hardhat.config.ts diff --git a/packages/ua-utils-evm-hardhat-test/jest.config.js b/tests/ua-utils-evm-hardhat-test/jest.config.js similarity index 100% rename from packages/ua-utils-evm-hardhat-test/jest.config.js rename to tests/ua-utils-evm-hardhat-test/jest.config.js diff --git a/packages/ua-utils-evm-hardhat-test/package.json b/tests/ua-utils-evm-hardhat-test/package.json similarity index 100% rename from packages/ua-utils-evm-hardhat-test/package.json rename to tests/ua-utils-evm-hardhat-test/package.json diff --git a/packages/ua-utils-evm-hardhat-test/tasks/index.ts b/tests/ua-utils-evm-hardhat-test/tasks/index.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/tasks/index.ts rename to tests/ua-utils-evm-hardhat-test/tasks/index.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts b/tests/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts rename to tests/ua-utils-evm-hardhat-test/test/__utils__/endpoint.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/__utils__/oapp.ts b/tests/ua-utils-evm-hardhat-test/test/__utils__/oapp.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/__utils__/oapp.ts rename to tests/ua-utils-evm-hardhat-test/test/__utils__/oapp.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/__utils__/omnicounter.ts b/tests/ua-utils-evm-hardhat-test/test/__utils__/omnicounter.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/__utils__/omnicounter.ts rename to tests/ua-utils-evm-hardhat-test/test/__utils__/omnicounter.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/endpoint/config.test.ts b/tests/ua-utils-evm-hardhat-test/test/endpoint/config.test.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/endpoint/config.test.ts rename to tests/ua-utils-evm-hardhat-test/test/endpoint/config.test.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/oapp/config.test.ts b/tests/ua-utils-evm-hardhat-test/test/oapp/config.test.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/oapp/config.test.ts rename to tests/ua-utils-evm-hardhat-test/test/oapp/config.test.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts b/tests/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts rename to tests/ua-utils-evm-hardhat-test/test/task/getDefaultConfig.test.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/task/getOAppConfig.test.ts b/tests/ua-utils-evm-hardhat-test/test/task/getOAppConfig.test.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/getOAppConfig.test.ts rename to tests/ua-utils-evm-hardhat-test/test/task/getOAppConfig.test.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.001.js b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.001.js similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.001.js rename to tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.001.js diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.js b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.js similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.js rename to tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.js diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.json b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.json similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.json rename to tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.json diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.connected.js b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.connected.js similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.connected.js rename to tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.connected.js diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.empty.js b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.empty.js similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.empty.js rename to tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.empty.js diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.empty.ts b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.empty.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.empty.ts rename to tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.empty.ts diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.misconfigured.001.js b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.misconfigured.001.js similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.misconfigured.001.js rename to tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.misconfigured.001.js diff --git a/tests/ua-utils-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap new file mode 100644 index 000000000..5e016ff4a --- /dev/null +++ b/tests/ua-utils-evm-hardhat-test/test/task/oapp/__snapshots__/wire.test.ts.snap @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`task/oapp/wire with invalid configs should fail if the config file does not exist 1`] = `[Error: Unable to read config file '/app/tests/ua-utils-evm-hardhat-test/does-not-exist.js'. Check that the file exists and is readable to your terminal user]`; + +exports[`task/oapp/wire with invalid configs should fail if the config file is not a file 1`] = `[Error: Unable to read config file '/app/tests/ua-utils-evm-hardhat-test/test/task/oapp'. Check that the file exists and is readable to your terminal user]`; + +exports[`task/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 '/app/tests/ua-utils-evm-hardhat-test/README.md': SyntaxError: Unexpected token '<']`; + +exports[`task/oapp/wire with invalid configs should fail with a malformed JS file (001) 1`] = ` +[Error: Config from file '/app/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.001.js' is malformed. Please fix the following errors: + +Property 'contracts.0.contract': Invalid input +Property 'contracts.1.contract': Invalid input +Property 'connections': Required] +`; + +exports[`task/oapp/wire with invalid configs should fail with a misconfigured file (001) 1`] = `[Error: Config from file '/app/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/valid.config.misconfigured.001.js' is invalid: AssertionError [ERR_ASSERTION]: Could not find a deployment for contract 'NonExistent']`; + +exports[`task/oapp/wire with invalid configs should fail with an empty JS file 1`] = ` +[Error: Config from file '/app/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.js' is malformed. Please fix the following errors: + +Property 'contracts': Required +Property 'connections': Required] +`; + +exports[`task/oapp/wire with invalid configs should fail with an empty JSON file 1`] = `[Error: Unable to read config file '/app/tests/ua-utils-evm-hardhat-test/test/task/oapp/__data__/configs/invalid.config.empty.json': SyntaxError: Unexpected end of JSON input]`; diff --git a/packages/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts b/tests/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts similarity index 100% rename from packages/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts rename to tests/ua-utils-evm-hardhat-test/test/task/oapp/wire.test.ts diff --git a/packages/ua-utils-evm-hardhat-test/tsconfig.json b/tests/ua-utils-evm-hardhat-test/tsconfig.json similarity index 100% rename from packages/ua-utils-evm-hardhat-test/tsconfig.json rename to tests/ua-utils-evm-hardhat-test/tsconfig.json diff --git a/packages/utils-evm-test/.eslintignore b/tests/utils-evm-test/.eslintignore similarity index 100% rename from packages/utils-evm-test/.eslintignore rename to tests/utils-evm-test/.eslintignore diff --git a/packages/utils-evm-test/.gitignore b/tests/utils-evm-test/.gitignore similarity index 100% rename from packages/utils-evm-test/.gitignore rename to tests/utils-evm-test/.gitignore diff --git a/packages/utils-evm-test/.prettierignore b/tests/utils-evm-test/.prettierignore similarity index 100% rename from packages/utils-evm-test/.prettierignore rename to tests/utils-evm-test/.prettierignore diff --git a/packages/utils-evm-test/README.md b/tests/utils-evm-test/README.md similarity index 100% rename from packages/utils-evm-test/README.md rename to tests/utils-evm-test/README.md diff --git a/packages/utils-evm-test/contracts/ChildEmitter.sol b/tests/utils-evm-test/contracts/ChildEmitter.sol similarity index 100% rename from packages/utils-evm-test/contracts/ChildEmitter.sol rename to tests/utils-evm-test/contracts/ChildEmitter.sol diff --git a/packages/utils-evm-test/contracts/Emitter.sol b/tests/utils-evm-test/contracts/Emitter.sol similarity index 100% rename from packages/utils-evm-test/contracts/Emitter.sol rename to tests/utils-evm-test/contracts/Emitter.sol diff --git a/packages/utils-evm-test/contracts/ParallelEmitter.sol b/tests/utils-evm-test/contracts/ParallelEmitter.sol similarity index 100% rename from packages/utils-evm-test/contracts/ParallelEmitter.sol rename to tests/utils-evm-test/contracts/ParallelEmitter.sol diff --git a/packages/utils-evm-test/contracts/Thrower.sol b/tests/utils-evm-test/contracts/Thrower.sol similarity index 100% rename from packages/utils-evm-test/contracts/Thrower.sol rename to tests/utils-evm-test/contracts/Thrower.sol diff --git a/packages/utils-evm-test/hardhat.config.ts b/tests/utils-evm-test/hardhat.config.ts similarity index 100% rename from packages/utils-evm-test/hardhat.config.ts rename to tests/utils-evm-test/hardhat.config.ts diff --git a/packages/utils-evm-test/jest.config.js b/tests/utils-evm-test/jest.config.js similarity index 100% rename from packages/utils-evm-test/jest.config.js rename to tests/utils-evm-test/jest.config.js diff --git a/packages/utils-evm-test/package.json b/tests/utils-evm-test/package.json similarity index 100% rename from packages/utils-evm-test/package.json rename to tests/utils-evm-test/package.json diff --git a/packages/utils-evm-test/test/errors/parser.test.ts b/tests/utils-evm-test/test/errors/parser.test.ts similarity index 100% rename from packages/utils-evm-test/test/errors/parser.test.ts rename to tests/utils-evm-test/test/errors/parser.test.ts diff --git a/packages/utils-evm-test/test/events/__snapshots__/parser.test.ts.snap b/tests/utils-evm-test/test/events/__snapshots__/parser.test.ts.snap similarity index 100% rename from packages/utils-evm-test/test/events/__snapshots__/parser.test.ts.snap rename to tests/utils-evm-test/test/events/__snapshots__/parser.test.ts.snap diff --git a/packages/utils-evm-test/test/events/parser.test.ts b/tests/utils-evm-test/test/events/parser.test.ts similarity index 100% rename from packages/utils-evm-test/test/events/parser.test.ts rename to tests/utils-evm-test/test/events/parser.test.ts diff --git a/packages/utils-evm-test/tsconfig.json b/tests/utils-evm-test/tsconfig.json similarity index 100% rename from packages/utils-evm-test/tsconfig.json rename to tests/utils-evm-test/tsconfig.json