From 76e9317a3d7fc54a37f2a0698bf4874bf60b74c4 Mon Sep 17 00:00:00 2001 From: Air1 Date: Mon, 6 Jul 2020 14:21:05 +0200 Subject: [PATCH] chore: remove obsolete matchers package from merge --- .../src/functional/unconfirmed.ts | 41 ------------------- .../src/functional/vote-balance.ts | 35 ---------------- 2 files changed, 76 deletions(-) delete mode 100644 packages/core-jest-matchers/src/functional/unconfirmed.ts delete mode 100644 packages/core-jest-matchers/src/functional/vote-balance.ts diff --git a/packages/core-jest-matchers/src/functional/unconfirmed.ts b/packages/core-jest-matchers/src/functional/unconfirmed.ts deleted file mode 100644 index 09aa55e537..0000000000 --- a/packages/core-jest-matchers/src/functional/unconfirmed.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Interfaces } from "@arkecosystem/crypto"; -import got from "got"; - -export {}; - -declare global { - namespace jest { - // tslint:disable-next-line:interface-name - interface Matchers { - toBeUnconfirmed(): Promise; - } - } -} - -expect.extend({ - toBeUnconfirmed: async (transaction: Interfaces.ITransactionData) => { - let pass: boolean = false; - let error: string; - - try { - const { body } = await got.get(`http://localhost:4003/api/v2/transactions/unconfirmed`); - - const parsedBody = JSON.parse(body); - - pass = !!(parsedBody.data as any[]).find((tx) => tx.id === transaction.id); - - error = JSON.stringify(parsedBody.errors); - } catch (e) { - error = e.message; - console.error(error); - } - - return { - pass, - message: () => - `expected ${transaction.id} ${this.isNot ? "not" : ""} to be unconfirmed (in the pool) ${ - error ? "(error: " + error + ")" : "" - }`, - }; - }, -}); diff --git a/packages/core-jest-matchers/src/functional/vote-balance.ts b/packages/core-jest-matchers/src/functional/vote-balance.ts deleted file mode 100644 index cc573eee2a..0000000000 --- a/packages/core-jest-matchers/src/functional/vote-balance.ts +++ /dev/null @@ -1,35 +0,0 @@ -import got from "got"; - -export {}; - -declare global { - namespace jest { - // tslint:disable-next-line:interface-name - interface Matchers { - toHaveVoteBalance(voteBalance: string): Promise; - } - } -} - -expect.extend({ - toHaveVoteBalance: async (publicKey: string, voteBalance: string) => { - let pass: boolean = false; - let fetchedVoteBalance: string; - try { - const { body } = await got.get(`http://localhost:4003/api/v2/delegates/${publicKey}`); - - const parsedBody = JSON.parse(body); - - fetchedVoteBalance = parsedBody.data.votes; - pass = fetchedVoteBalance === voteBalance; - } catch (e) {} // tslint:disable-line - - return { - pass, - message: () => - `expected delegate ${publicKey} ${ - this.isNot ? "not" : "" - } to have vote balance = ${voteBalance}, got ${fetchedVoteBalance}`, - }; - }, -});