Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse matrix helpers from @eng-automation/testing #412

Merged
merged 5 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
},
"devDependencies": {
"@eng-automation/js-style": "^2.3.0",
"@eng-automation/testing": "^1.3.0",
"@types/body-parser": "^1.19.2",
"@types/express": "^4.17.13",
"@types/jest": "^29.4.0",
Expand Down
8 changes: 4 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { logger } from "./logger";
export type SpecType<T> = T extends { type: "string" }
? string
: T extends { type: "number" }
? number
: T extends { type: "boolean" }
? boolean
: never;
? number
: T extends { type: "boolean" }
? boolean
: never;

function resolveConfig(): ConfigObject {
const specs = ConfigManager.loadSpecsFromYaml(`env.faucet.config.json`);
Expand Down
4 changes: 3 additions & 1 deletion src/faucet.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { until, validatedFetch } from "@eng-automation/js";
import { matrixHelpers } from "@eng-automation/testing";
import { e2e_parachain, e2e_relaychain } from "@polkadot-api/descriptors";
import crypto from "crypto";
import Joi from "joi";
Expand All @@ -10,12 +11,13 @@ import { Repository } from "typeorm";
import { Drip } from "src/db/entity/Drip";
import { drip } from "src/test/webhookHelpers";

import { getLatestMessage, postMessage } from "./test/matrixHelpers";
import { destroyDataSource, E2ESetup, getDataSource, setup, teardown } from "./test/setupE2E";

const randomAddress = () => AccountId().dec(crypto.randomBytes(32));
const sha256 = (x: string) => crypto.createHash("sha256").update(x, "utf8").digest("hex");

const { getLatestMessage, postMessage } = matrixHelpers;

describe("Faucet E2E", () => {
const PARACHAIN_ID = 1000; // From the zombienet config.
let roomId: string;
Expand Down
117 changes: 0 additions & 117 deletions src/test/matrixHelpers.ts

This file was deleted.

4 changes: 3 additions & 1 deletion src/test/setupE2E.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ import {
import path from "path";
import { promises as fs } from "fs";
import { exec } from "child_process";
import { createRoom, getAccessToken, inviteUser, joinRoom } from "./matrixHelpers";
import { matrixHelpers } from "@eng-automation/testing";
import { Readable } from "stream";
import { DataSource } from "typeorm";
import { Drip } from "src/db/entity/Drip";
import { migrations } from "src/db/migration/migrations";
import { PostgresConnectionOptions } from "typeorm/driver/postgres/PostgresConnectionOptions";
import { DEV_PHRASE } from "@polkadot-labs/hdkd-helpers";

const { createRoom, getAccessToken, inviteUser, joinRoom } = matrixHelpers

export type E2ESetup = {
matrixContainer: StartedTestContainer;
dbContainer: StartedTestContainer;
Expand Down
Loading
Loading