Skip to content

Commit

Permalink
testnet tests
Browse files Browse the repository at this point in the history
  • Loading branch information
soerenbf committed Jun 27, 2023
1 parent a46df05 commit 480661b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 6 additions & 9 deletions packages/nodejs/test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,21 @@ import { getNodeClient } from './testHelpers';
* remove the v1 API entirely.
*/

const address = 'concordiumwalletnode.com';
const port = 10000;

const client = getNodeClient(address, port);
const client = getNodeClient();

// eslint-disable-next-line prefer-const
let CHAIN_GENESIS_BLOCK: string | undefined = undefined;
// eslint-disable-next-line prefer-const
let PV4_BLOCK: string | undefined = undefined;
let PV5_BLOCK: string | undefined = undefined;
// eslint-disable-next-line prefer-const
let PV6_BLOCK: string | undefined = undefined;

// Mainnet blocks.
// Testnet blocks.
CHAIN_GENESIS_BLOCK =
'9dd9ca4d19e9393877d2c44b70f89acbfc0883c2243e5eeaecc0d1cd0503f478';
PV4_BLOCK = '568589c9f5b3a3989c24d4c916bc2417a64c6dff6ec987595349c551a829d332';
'4221332d34e1694168c2a0c0b3fd0f273809612cb13d000d5c2e00e85f50f796';
PV5_BLOCK = '58daebb41ca195442593e10c1a67279bb839a8195c8ea7442ea7116d87114fbb';

test.each([CHAIN_GENESIS_BLOCK, PV4_BLOCK, PV6_BLOCK])(
test.each([CHAIN_GENESIS_BLOCK, PV5_BLOCK, PV6_BLOCK])(
'blockSummary format as expected',
async (block) => {
if (block === undefined) {
Expand Down
14 changes: 9 additions & 5 deletions packages/nodejs/test/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ import 'isomorphic-fetch';

export { getModuleBuffer } from '../src/util';

const TESTNET_NODE = 'node.testnet.concordium.com';
const GRPCV1_PORT = 10000;
const GRPCV2_PORT = 20000;

/**
* Creates a gRPC v1 client (for nodeJS) to communicate with a local concordium-node
* used for automatic tests.
*/
export function getNodeClient(
address = '127.0.0.1',
port = 10000
address = TESTNET_NODE,
port = GRPCV1_PORT
): ConcordiumNodeClient {
const metadata = new Metadata();
metadata.add('authentication', 'rpcadmin');
Expand All @@ -37,8 +41,8 @@ export function getNodeClient(
* used for automatic tests.
*/
export function getNodeClientV2(
address = 'node.testnet.concordium.com',
port = 20000
address = TESTNET_NODE,
port = GRPCV2_PORT
): ConcordiumGRPCClient {
return createConcordiumClient(address, port, credentials.createInsecure(), {
timeout: 15000,
Expand All @@ -52,7 +56,7 @@ export function getNodeClientV2(
*/
export function getNodeClientWeb(
address = 'http://node.testnet.concordium.com',
port = 20000
port = GRPCV2_PORT
): ConcordiumGRPCClient {
const transport = new GrpcWebFetchTransport({
baseUrl: `${address}:${port}`,
Expand Down

0 comments on commit 480661b

Please sign in to comment.