Skip to content

Commit

Permalink
chore(test): update e2e test to use configurable AO
Browse files Browse the repository at this point in the history
We will create a docker file to spin up an AO CU locally in our tests to avoid going to real CUs. This sets up the tests to support those changes when we get to it.
  • Loading branch information
dtfiedler committed Sep 12, 2024
1 parent 3a6a170 commit 48131fa
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 6 deletions.
10 changes: 9 additions & 1 deletion tests/e2e/cjs/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const {
IOWriteable,
AoANTWriteable,
AoANTRegistryWriteable,
AOProcess,
} = require('@ar.io/sdk');
const { connect } = require('@permaweb/aoconnect');

const testWalletJSON = fs.readFileSync('../test-wallet.json', {
encoding: 'utf-8',
Expand All @@ -27,8 +29,14 @@ const signers = [
];

const io = IO.init({
processId: ioDevnetProcessId,
process: new AOProcess({
processId: process.env.IO_PROCESS_ID || ioDevnetProcessId,
ao: connect({
CU_URL: process.env.AO_CU_URL || 'https://cu.ao-testnet.xyz',
}),
}),
});

describe('IO', async () => {
it('should be able to get the process information', async () => {
const epoch = await io.getInfo();
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"test": "node --enable-source-maps index.test.js && echo '\nNode CJS Integration ✅'"
},
"dependencies": {
"@ar.io/sdk": "*"
"@ar.io/sdk": "*",
"@permaweb/aoconnect": "^0.0.59"
},
"license": "AGPL-3.0-or-later"
}
67 changes: 67 additions & 0 deletions tests/e2e/cjs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,29 @@
resolved "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.3.tgz"
integrity sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==

"@permaweb/ao-scheduler-utils@~0.0.23":
version "0.0.24"
resolved "https://registry.yarnpkg.com/@permaweb/ao-scheduler-utils/-/ao-scheduler-utils-0.0.24.tgz#a7d2c1e09f9b6ea5d45127fa395bbbcef6688452"
integrity sha512-G6109Nz8+dQFPuG7mV8mz66kLVA+gl2uTSqU7qpaRwfujrWi6obM94CpmvyvAnrLo3dB29EYiuv7+KOKcns8ig==
dependencies:
lru-cache "^10.2.2"
ramda "^0.30.0"
zod "^3.23.5"

"@permaweb/aoconnect@^0.0.59":
version "0.0.59"
resolved "https://registry.yarnpkg.com/@permaweb/aoconnect/-/aoconnect-0.0.59.tgz#0ceb6257e2f376f4af6783163e3037240560dff1"
integrity sha512-AgnUv50hp3BVvqWk2IOw3p9ksF2GblFwQHCIWqwTYjvdViCPlsL4gx/BefxFqbMABXQ5q2QJItMJLlPelqC2CQ==
dependencies:
"@permaweb/ao-scheduler-utils" "~0.0.23"
buffer "^6.0.3"
debug "^4.3.6"
hyper-async "^1.1.2"
mnemonist "^0.39.8"
ramda "^0.30.1"
warp-arbundles "^1.0.4"
zod "^3.23.8"

"@randlabs/communication-bridge@1.0.1":
version "1.0.1"
resolved "https://registry.npmjs.org/@randlabs/communication-bridge/-/communication-bridge-1.0.1.tgz"
Expand Down Expand Up @@ -730,6 +753,13 @@ cross-fetch@^3.1.5:
dependencies:
node-fetch "^2.6.12"

debug@^4.3.6:
version "4.3.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
dependencies:
ms "^2.1.3"

delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
Expand Down Expand Up @@ -869,6 +899,11 @@ hmac-drbg@^1.0.1:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.1"

hyper-async@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/hyper-async/-/hyper-async-1.1.2.tgz#b9a83be36e726bface6f4a5b84f1a1a25bf19e6a"
integrity sha512-cnpOgKa+5FZOaccTtjduac1FrZuSc38/ftCp3vYJdUMt+7c+uvGDKLDK4MTNK8D3aFjIeveVrPcSgUPvzZLopg==

ieee754@^1.1.13, ieee754@^1.2.1:
version "1.2.1"
resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz"
Expand Down Expand Up @@ -995,6 +1030,11 @@ lodash.union@^4.6.0:
resolved "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz"
integrity sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==

lru-cache@^10.2.2:
version "10.4.3"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119"
integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==

memory-level@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/memory-level/-/memory-level-1.0.0.tgz"
Expand Down Expand Up @@ -1052,6 +1092,13 @@ mkdirp@~0.5.1:
dependencies:
minimist "^1.2.6"

mnemonist@^0.39.8:
version "0.39.8"
resolved "https://registry.yarnpkg.com/mnemonist/-/mnemonist-0.39.8.tgz#9078cd8386081afd986cca34b52b5d84ea7a4d38"
integrity sha512-vyWo2K3fjrUw8YeeZ1zF0fy6Mu59RHokURlld8ymdUPjMlD9EC9ov1/YPqTgqRvUN9nTr3Gqfz29LYAmu0PHPQ==
dependencies:
obliterator "^2.0.1"

module-error@^1.0.1, module-error@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz"
Expand All @@ -1062,6 +1109,11 @@ moment@^2.19.3:
resolved "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz"
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==

ms@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==

multistream@^4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/multistream/-/multistream-4.1.0.tgz"
Expand Down Expand Up @@ -1121,6 +1173,11 @@ normalize-path@^3.0.0:
resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==

obliterator@^2.0.1:
version "2.0.4"
resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816"
integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==

once@^1.3.0, once@^1.4.0:
version "1.4.0"
resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz"
Expand Down Expand Up @@ -1148,6 +1205,11 @@ queue-microtask@^1.2.2, queue-microtask@^1.2.3:
resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==

ramda@^0.30.0, ramda@^0.30.1:
version "0.30.1"
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.30.1.tgz#7108ac95673062b060025052cd5143ae8fc605bf"
integrity sha512-tEF5I22zJnuclswcZMc8bDIrwRHRzf+NqVEmqg50ShAZMP7MWeR/RGDthfM/p+BlqvF2fXAzpn8i+SJcYD3alw==

readable-stream@^2.0.0, readable-stream@^2.0.5:
version "2.3.8"
resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz"
Expand Down Expand Up @@ -1415,3 +1477,8 @@ zip-stream@^4.1.0:
archiver-utils "^3.0.4"
compress-commons "^4.1.2"
readable-stream "^3.6.0"

zod@^3.23.5, zod@^3.23.8:
version "3.23.8"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d"
integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==
9 changes: 8 additions & 1 deletion tests/e2e/esm/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
ANT,
ANTRegistry,
AOProcess,
AoANTRegistryWriteable,
AoANTWriteable,
ArweaveSigner,
Expand All @@ -9,6 +10,7 @@ import {
createAoSigner,
ioDevnetProcessId,
} from '@ar.io/sdk';
import { connect } from '@permaweb/aoconnect';
import { strict as assert } from 'node:assert';
import fs from 'node:fs';
import { describe, it } from 'node:test';
Expand All @@ -29,7 +31,12 @@ const signers = [
*/

const io = IO.init({
processId: ioDevnetProcessId,
process: new AOProcess({
processId: ioDevnetProcessId,
ao: connect({
CU_URL: process.env.AO_CU_URL || 'https://cu.ao-testnet.xyz',
}),
}),
});

describe('IO', async () => {
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"test": "node --enable-source-maps index.test.js && echo '\nNode ESM Integration ✅'"
},
"dependencies": {
"@ar.io/sdk": "*"
"@ar.io/sdk": "*",
"@permaweb/aoconnect": "^0.0.59"
},
"license": "AGPL-3.0-or-later"
}
67 changes: 67 additions & 0 deletions tests/e2e/esm/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,29 @@
resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.3.tgz#57e1677bf6885354b466c38e2b620c62f45a7123"
integrity sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==

"@permaweb/ao-scheduler-utils@~0.0.23":
version "0.0.24"
resolved "https://registry.yarnpkg.com/@permaweb/ao-scheduler-utils/-/ao-scheduler-utils-0.0.24.tgz#a7d2c1e09f9b6ea5d45127fa395bbbcef6688452"
integrity sha512-G6109Nz8+dQFPuG7mV8mz66kLVA+gl2uTSqU7qpaRwfujrWi6obM94CpmvyvAnrLo3dB29EYiuv7+KOKcns8ig==
dependencies:
lru-cache "^10.2.2"
ramda "^0.30.0"
zod "^3.23.5"

"@permaweb/aoconnect@^0.0.59":
version "0.0.59"
resolved "https://registry.yarnpkg.com/@permaweb/aoconnect/-/aoconnect-0.0.59.tgz#0ceb6257e2f376f4af6783163e3037240560dff1"
integrity sha512-AgnUv50hp3BVvqWk2IOw3p9ksF2GblFwQHCIWqwTYjvdViCPlsL4gx/BefxFqbMABXQ5q2QJItMJLlPelqC2CQ==
dependencies:
"@permaweb/ao-scheduler-utils" "~0.0.23"
buffer "^6.0.3"
debug "^4.3.6"
hyper-async "^1.1.2"
mnemonist "^0.39.8"
ramda "^0.30.1"
warp-arbundles "^1.0.4"
zod "^3.23.8"

"@randlabs/communication-bridge@1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@randlabs/communication-bridge/-/communication-bridge-1.0.1.tgz#d1ecfc29157afcbb0ca2d73122d67905eecb5bf3"
Expand Down Expand Up @@ -730,6 +753,13 @@ cross-fetch@^3.1.5:
dependencies:
node-fetch "^2.6.12"

debug@^4.3.6:
version "4.3.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
dependencies:
ms "^2.1.3"

delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
Expand Down Expand Up @@ -869,6 +899,11 @@ hmac-drbg@^1.0.1:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.1"

hyper-async@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/hyper-async/-/hyper-async-1.1.2.tgz#b9a83be36e726bface6f4a5b84f1a1a25bf19e6a"
integrity sha512-cnpOgKa+5FZOaccTtjduac1FrZuSc38/ftCp3vYJdUMt+7c+uvGDKLDK4MTNK8D3aFjIeveVrPcSgUPvzZLopg==

ieee754@^1.1.13, ieee754@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
Expand Down Expand Up @@ -995,6 +1030,11 @@ lodash.union@^4.6.0:
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"
integrity sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==

lru-cache@^10.2.2:
version "10.4.3"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119"
integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==

memory-level@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/memory-level/-/memory-level-1.0.0.tgz#7323c3fd368f9af2f71c3cd76ba403a17ac41692"
Expand Down Expand Up @@ -1052,6 +1092,13 @@ mkdirp@~0.5.1:
dependencies:
minimist "^1.2.6"

mnemonist@^0.39.8:
version "0.39.8"
resolved "https://registry.yarnpkg.com/mnemonist/-/mnemonist-0.39.8.tgz#9078cd8386081afd986cca34b52b5d84ea7a4d38"
integrity sha512-vyWo2K3fjrUw8YeeZ1zF0fy6Mu59RHokURlld8ymdUPjMlD9EC9ov1/YPqTgqRvUN9nTr3Gqfz29LYAmu0PHPQ==
dependencies:
obliterator "^2.0.1"

module-error@^1.0.1, module-error@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/module-error/-/module-error-1.0.2.tgz#8d1a48897ca883f47a45816d4fb3e3c6ba404d86"
Expand All @@ -1062,6 +1109,11 @@ moment@^2.19.3:
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==

ms@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==

multistream@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/multistream/-/multistream-4.1.0.tgz#7bf00dfd119556fbc153cff3de4c6d477909f5a8"
Expand Down Expand Up @@ -1121,6 +1173,11 @@ normalize-path@^3.0.0:
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==

obliterator@^2.0.1:
version "2.0.4"
resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816"
integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==

once@^1.3.0, once@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
Expand Down Expand Up @@ -1148,6 +1205,11 @@ queue-microtask@^1.2.2, queue-microtask@^1.2.3:
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==

ramda@^0.30.0, ramda@^0.30.1:
version "0.30.1"
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.30.1.tgz#7108ac95673062b060025052cd5143ae8fc605bf"
integrity sha512-tEF5I22zJnuclswcZMc8bDIrwRHRzf+NqVEmqg50ShAZMP7MWeR/RGDthfM/p+BlqvF2fXAzpn8i+SJcYD3alw==

readable-stream@^2.0.0, readable-stream@^2.0.5:
version "2.3.8"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b"
Expand Down Expand Up @@ -1415,3 +1477,8 @@ zip-stream@^4.1.0:
archiver-utils "^3.0.4"
compress-commons "^4.1.2"
readable-stream "^3.6.0"

zod@^3.23.5, zod@^3.23.8:
version "3.23.8"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d"
integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==
1 change: 1 addition & 0 deletions tests/e2e/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"dependencies": {
"@ar.io/sdk": "*",
"@permaweb/aoconnect": "^0.0.59",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^9.0.1",
Expand Down
12 changes: 10 additions & 2 deletions tests/e2e/web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { ANTRegistry, IO } from '@ar.io/sdk/web';
import { ANTRegistry, AOProcess, IO, ioDevnetProcessId } from '@ar.io/sdk/web';
import { connect } from '@permaweb/aoconnect';
import { useEffect, useState } from 'react';
import Markdown from 'react-markdown';
import remarkGfm from 'remark-gfm';

import './App.css';

const io = IO.init();
const io = IO.init({
process: new AOProcess({
processId: process.env.IO_PROCESS_ID || ioDevnetProcessId,
ao: connect({
CU_URL: process.env.AO_CU_URL || 'https://cu.ao-testnet.xyz',
}),
}),
});
const antRegistry = ANTRegistry.init();
function App() {
const [contract, setContract] = useState<string>('Loading...');
Expand Down

0 comments on commit 48131fa

Please sign in to comment.