Skip to content

Commit

Permalink
feat(core-test-framework): support modifiers in transaction factories
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored Nov 28, 2019
1 parent 57774f0 commit 5191f69
Show file tree
Hide file tree
Showing 50 changed files with 192 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "jest-extended";

import { Contracts, Container } from "@arkecosystem/core-kernel";
import { Utils, Identities } from "@arkecosystem/crypto";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";

jest.setTimeout(1200000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Identities } from "@arkecosystem/crypto";
import { generateMnemonic } from "bip39";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

let app: Contracts.Kernel.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Identities } from "@arkecosystem/crypto";
import { generateMnemonic } from "bip39";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

let app: Contracts.Kernel.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Identities } from "@arkecosystem/crypto";
import { generateMnemonic } from "bip39";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

let app: Contracts.Kernel.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Identities } from "@arkecosystem/crypto";
import { generateMnemonic } from "bip39";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

let app: Contracts.Kernel.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Identities } from "@arkecosystem/crypto";
import { generateMnemonic } from "bip39";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

let app: Contracts.Kernel.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Identities } from "@arkecosystem/crypto";
import { generateMnemonic } from "bip39";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

let app: Contracts.Kernel.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contracts } from "@arkecosystem/core-kernel";
import { Identities } from "@arkecosystem/crypto";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Identities } from "@arkecosystem/crypto";

import { generateMnemonic } from "bip39";
import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const genesisPassphrase: string = secrets[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contracts } from "@arkecosystem/core-kernel";
import { Crypto, Enums, Identities } from "@arkecosystem/crypto";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/functional/transaction-forging/htlc-lock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contracts } from "@arkecosystem/core-kernel";
import { Crypto, Enums, Identities } from "@arkecosystem/crypto";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contracts } from "@arkecosystem/core-kernel";
import { Crypto, Enums, Identities } from "@arkecosystem/crypto";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/functional/transaction-forging/ipfs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contracts } from "@arkecosystem/core-kernel";
import { Identities } from "@arkecosystem/crypto";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contracts } from "@arkecosystem/core-kernel";
import { Identities, Utils, Managers } from "@arkecosystem/crypto";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
injectMilestone,
TransactionFactory,
} from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contracts } from "@arkecosystem/core-kernel";
import { Identities } from "@arkecosystem/crypto";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

let app: Contracts.Kernel.Application;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/functional/transaction-forging/transfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
injectMilestone,
TransactionFactory,
} from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/functional/transaction-forging/vote.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contracts } from "@arkecosystem/core-kernel";
import { Identities } from "@arkecosystem/crypto";

import { snoozeForBlock, TransactionFactory } from "@packages/core-test-framework/src/utils";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import * as support from "./__support__";

const { passphrase, secondPassphrase } = support.passphrases;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/core-api/handlers/blocks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "@packages/core-test-framework/src/matchers";
import { setUp, tearDown } from "../__support__/setup";

import { Contracts, Container } from "@arkecosystem/core-kernel";
import { Interfaces,Managers } from "@arkecosystem/crypto";
import { Interfaces, Managers } from "@arkecosystem/crypto";
import { Repositories } from "@arkecosystem/core-database";

import { ApiHelpers, Factories } from "@packages/core-test-framework/src";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Repositories } from "@arkecosystem/core-database";
import { generateMnemonic } from "bip39";

import { TransactionFactory } from "@packages/core-test-framework/src/utils/transaction-factory";
import secrets from "@packages/core-test-framework/src/internal/secrets.json";
import secrets from "@packages/core-test-framework/src/internal/passphrases.json";
import { ApiHelpers, getWalletNonce } from "@packages/core-test-framework/src";
import { Contracts } from "@arkecosystem/core-kernel";

Expand Down
2 changes: 0 additions & 2 deletions packages/core-api/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,11 @@ export class Server {
},
routes: {
payload: {
/* istanbul ignore next */
async failAction(request, h, err) {
return badData(err.message);
},
},
validate: {
/* istanbul ignore next */
async failAction(request, h, err) {
return badData(err.message);
},
Expand Down
1 change: 0 additions & 1 deletion packages/core-kernel/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ export class Application implements Contracts.Kernel.Application {
public rebind<T>(
serviceIdentifier: Contracts.Kernel.Container.ServiceIdentifier<T>,
): Contracts.Kernel.Container.BindingToSyntax<T> {
/* istanbul ignore else */
if (this.container.isBound(serviceIdentifier)) {
this.container.unbind(serviceIdentifier);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export class BootServiceProviders implements Bootstrapper {
await this.serviceProviders.dispose(name);
}

/* istanbul ignore else */
if (this.serviceProviders.deferred(name) && (await serviceProvider.bootWhen(previous))) {
await this.serviceProviders.boot(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,11 @@ export class RegisterServiceProviders implements Bootstrapper {
return false;
}

/* istanbul ignore else */
if (constraint) {
const version: string | undefined = serviceProviders.get(name).version();

assert.defined<string>(version);

/* istanbul ignore else */
if (!semver.satisfies(version, constraint)) {
const error: DependencyVersionOutOfRange = new DependencyVersionOutOfRange(
name,
Expand Down
1 change: 0 additions & 1 deletion packages/core-kernel/src/services/config/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class Watcher {

this.watcher = await nsfw(this.app.configPath(), (events: FileEvent[]) => {
for (const event of events) {
/* istanbul ignore else */
if (configFiles.includes(event.file) && event.action === nsfw.actions.MODIFIED) {
this.app.reboot();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export class JoiValidator implements Validator {
for (const error of this.resultError) {
const errorKey: string | number = error.path[0];

/* istanbul ignore else */
if (!Array.isArray(errors[errorKey])) {
errors[errorKey] = [];
}
Expand Down
3 changes: 0 additions & 3 deletions packages/core-logger-pino/src/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,15 @@ export class PinoLogger implements Contracts.Kernel.Logger {
try {
const json = JSON.parse(chunk);

/* istanbul ignore else */
if (getLevel(json.level) >= getLevel(level)) {
const line: string | undefined = pinoPretty(json);

/* istanbul ignore else */
if (line !== undefined) {
return cb(undefined, line.replace("USERLVL", formatLevel(json.level)));
}
}
} catch {}

/* istanbul ignore next */
return cb();
},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DelegateFactory } from "@arkecosystem/core-forger";
import { Crypto, Managers } from "@arkecosystem/crypto";

import secrets from "../../internal/passphrases.json";
import { Signer } from "../../internal/signer";
import secrets from "../../internal/secrets.json";
import { FactoryBuilder } from "../factory-builder";

export const registerBlockFactory = (factory: FactoryBuilder): void => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core-test-framework/src/factories/factories/round.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Utils } from "@arkecosystem/core-kernel";
import { Wallets } from "@arkecosystem/core-state";
import { Identities } from "@arkecosystem/crypto";

import { FactoryBuilder } from "../factory-builder";
import passphrases from "../../internal/secrets.json";
import passphrases from "../../internal/passphrases.json";
import { knownAttributes } from "../../internal/wallet-attributes";
import { FactoryBuilder } from "../factory-builder";

export const registerRoundFactory = (factory: FactoryBuilder): void => {
factory.set("Round", ({ options }) => {
Expand Down
Loading

0 comments on commit 5191f69

Please sign in to comment.