Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Sep 8, 2023
1 parent c7b8c8d commit bbe1681
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions yarn-project/end-to-end/src/cli_docs_sandbox.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AztecAddress, createAztecRpcClient, createDebugLogger, makeFetch, waitForSandbox } from '@aztec/aztec.js';
import { getProgram } from '@aztec/cli';
import { AztecRPC, TxHash } from '@aztec/types';
import { TxHash } from '@aztec/types';

import stringArgv from 'string-argv';
import { format } from 'util';
Expand All @@ -11,16 +11,18 @@ const { SANDBOX_URL = 'http://localhost:8080' } = process.env;

describe('CLI docs sandbox', () => {
let cli: ReturnType<typeof getProgram>;
let aztecRpc: AztecRPC;
let log: (...args: any[]) => void;

// All logs emitted by the cli will be collected here, and reset between tests
const logs: string[] = [];

beforeAll(async () => {
aztecRpc = createAztecRpcClient(SANDBOX_URL, makeFetch([1, 2, 3], true));
const aztecRpc = createAztecRpcClient(SANDBOX_URL, makeFetch([1, 2, 3], true));
await waitForSandbox(aztecRpc);

// Requesting node info with the fetch which retries to ensure sandbox is ready
await aztecRpc.getNodeInfo();

log = (...args: any[]) => {
logs.push(format(...args));
debug(...args);
Expand Down Expand Up @@ -359,24 +361,24 @@ View result: 543n
.replace('$ADDRESS', newAddress.toString())
.replace('$CONTRACT_ADDRESS', contractAddress.toString());

await run(command);
// await run(command);

foundBalance = findInLogs(/View\sresult:\s+(?<data>\S+)/)?.groups?.data;
expect(foundBalance!).toEqual(`${BigInt(999457).toString()}n`);
// expect(foundBalance!).toEqual(`${BigInt(999457).toString()}n`);

clearLogs();
// clearLogs();

command = docs
.split('\n')[6]
.split('aztec-cli ')[1]
.replace('$ADDRESS2', address2.toString())
.replace('$CONTRACT_ADDRESS', contractAddress.toString());
// command = docs
// .split('\n')[6]
// .split('aztec-cli ')[1]
// .replace('$ADDRESS2', address2.toString())
// .replace('$CONTRACT_ADDRESS', contractAddress.toString());

await run(command);
// await run(command);

foundBalance = findInLogs(/View\sresult:\s+(?<data>\S+)/)?.groups?.data;
expect(foundBalance!).toEqual(`${BigInt(543).toString()}n`);
// foundBalance = findInLogs(/View\sresult:\s+(?<data>\S+)/)?.groups?.data;
// expect(foundBalance!).toEqual(`${BigInt(543).toString()}n`);

clearLogs();
// clearLogs();
}, 60_000);
});

0 comments on commit bbe1681

Please sign in to comment.