Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 9x 9x 51x 51x 1581x 51x 420x 48x 420x 13x 13x 16x 16x 16x 16x 16x 19x 13x 13x 390x 390x 13x | import GmailTransactionTestHelper from "../../gmail/utils/gmailTransactionTestHelper"; import { PaymentDetailsTestCase, PaymentDetailsTestCaseData } from "../types/paymentDetailsTestCase"; export default class TransactionTestHelper { private ids: string[] = []; private gmailTransactionTestHelper: GmailTransactionTestHelper | undefined; public withTestCases(testCases: PaymentDetailsTestCase<PaymentDetailsTestCaseData>) { this.ids = Object .keys(testCases) .filter(k => isNaN(Number(k))); return this; } public useGmailContext() { if (!this.gmailTransactionTestHelper) { this.gmailTransactionTestHelper = new GmailTransactionTestHelper(); } return this.gmailTransactionTestHelper; } public randomise() { this.ids = this.durstenfeldShuffle(this.ids); return this; } public randomCount(small: boolean = false) { const max = !small ? this.ids.length : this.ids.length / 2; const min = !small ? this.ids.length / 2 : this.ids.length / 4; const size = Math.random() * (max - min) + min; this.ids = this.ids.slice(0, size); return this; } public resolveTransactionIds(from?: string, to?: string) { return from !== undefined && to !== undefined ? this.ids.slice(this.ids.indexOf(from)+1, this.ids.indexOf(to)+1) : from !== undefined && to === undefined ? this.ids.slice(this.ids.indexOf(from)+1) : from === undefined && to !== undefined ? this.ids.slice(0, this.ids.indexOf(to)+1) : this.ids; } private durstenfeldShuffle<T>(array: Array<T>) { const result = array.slice(0); for (let i = result.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [result[i], result[j]] = [result[j], result[i]]; } return result; } } |