Skip to content

Commit

Permalink
chore: update dependencies and apply formatting (#3624)
Browse files Browse the repository at this point in the history
  • Loading branch information
faustbrian authored Mar 30, 2020
1 parent a82a094 commit e6d579d
Show file tree
Hide file tree
Showing 313 changed files with 4,029 additions and 4,431 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
Expand Down
10 changes: 5 additions & 5 deletions __tests__/e2e/lib/config/peer-discovery/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const express = require('express');
const express = require("express");
const app = express();

const ips = {};
const sources = [];
app.get('/', function (req, res) {
app.get("/", function (req, res) {
console.log(`received peer discovery request from ${req.ip} !`);
if (!ips[req.ip]) {
ips[req.ip] = true;
sources.push({ ip: req.ip, port: 4000 });
}
console.log(`responding with ${JSON.stringify(sources)}`);
res.send(sources);
})
});

app.listen(3000, function () {
console.log('Peer discovery app listening on port 3000!')
})
console.log("Peer discovery app listening on port 3000!");
});
4 changes: 2 additions & 2 deletions __tests__/functional/transaction-forging/__support__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export const setUp = async (): Promise<Contracts.Kernel.Application> => {
flags: {
token: "ark",
network: "testnet",
env: "test"
env: "test",
},
peers: {
list: [ { ip: "127.0.0.1", port: 4000 }]
list: [{ ip: "127.0.0.1", port: 4000 }],
},
});
await sandbox.boot(async ({ app }) => {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/integration/core-api/__support__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export const setUp = async () => {
flags: {
token: "ark",
network: "unitnet",
env: "test"
env: "test",
},
peers: {
list: [ { ip: "127.0.0.1", port: 4000 }] // need some peers defined for the app to run
list: [{ ip: "127.0.0.1", port: 4000 }], // need some peers defined for the app to run
},
});
await sandbox
Expand Down Expand Up @@ -129,7 +129,7 @@ export const calculateRanks = async () => {
.comparedTo(a.getAttribute<Utils.BigNumber>("delegate.voteBalance")),
);

AppUtils.sortBy(delegateWallets, wallet => wallet.publicKey).forEach((delegate, i) => {
AppUtils.sortBy(delegateWallets, (wallet) => wallet.publicKey).forEach((delegate, i) => {
const wallet = walletRepository.findByPublicKey(delegate.publicKey!);
wallet.setAttribute("delegate.rank", i + 1);

Expand Down
8 changes: 4 additions & 4 deletions __tests__/integration/core-api/handlers/locks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,31 +81,31 @@ describe("API 2.0 - Locks", () => {
expect(response).toBeSuccessfulResponse();
expect(response.data.data).toBeArray();
expect(response.data.data).not.toBeEmpty();
expect(response.data.data.every(lock => lock.expirationType === 1)).toBeTrue();
expect(response.data.data.every((lock) => lock.expirationType === 1)).toBeTrue();
});

it("should GET all the locks by height expiration", async () => {
const response = await api.request("GET", "locks", { expirationType: 2 });
expect(response).toBeSuccessfulResponse();
expect(response.data.data).toBeArray();
expect(response.data.data).not.toBeEmpty();
expect(response.data.data.every(lock => lock.expirationType === 2)).toBeTrue();
expect(response.data.data.every((lock) => lock.expirationType === 2)).toBeTrue();
});

it("should GET all the locks that are expired", async () => {
const response = await api.request("GET", "locks", { isExpired: true });
expect(response).toBeSuccessfulResponse();
expect(response.data.data).toBeArray();
expect(response.data.data).not.toBeEmpty();
expect(response.data.data.every(lock => lock.isExpired)).toBeTrue();
expect(response.data.data.every((lock) => lock.isExpired)).toBeTrue();
});

it("should GET all the locks that are not expired", async () => {
const response = await api.request("GET", "locks", { isExpired: false });
expect(response).toBeSuccessfulResponse();
expect(response.data.data).toBeArray();
expect(response.data.data).not.toBeEmpty();
expect(response.data.data.every(lock => !lock.isExpired)).toBeTrue();
expect(response.data.data.every((lock) => !lock.isExpired)).toBeTrue();
});

describe("orderBy", () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/core-api/handlers/peers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ beforeAll(async () => {
app = await setUp();
api = new ApiHelpers(app);

const peerMocks = peers.map(mock => {
const peerMocks = peers.map((mock) => {
const peerMock = new Peer(mock.ip, mock.port);
peerMock.version = mock.version;
peerMock.latency = mock.latency;
Expand Down
22 changes: 12 additions & 10 deletions __tests__/integration/core-api/handlers/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { generateMnemonic } from "bip39";

import { setUp, tearDown } from "../__support__/setup";

export const generateWallets = quantity => {
export const generateWallets = (quantity) => {
const wallets: { address: string; passphrase: string; publicKey: string }[] = [];

for (let i = 0; i < quantity; i++) {
Expand Down Expand Up @@ -56,13 +56,13 @@ beforeAll(async () => {
app = await setUp();
api = new ApiHelpers(app);

delegates = secrets.map(secret => {
delegates = secrets.map((secret) => {
const publicKey: string = Identities.PublicKey.fromPassphrase(secret);
const address: string = Identities.Address.fromPassphrase(secret);

const transaction: { amount: string } = Managers.configManager
.get("genesisBlock")
.transactions.find(transaction => transaction.recipientId === address && transaction.type === 0);
.transactions.find((transaction) => transaction.recipientId === address && transaction.type === 0);

return {
secret,
Expand Down Expand Up @@ -705,7 +705,7 @@ describe("API 2.0 - Transactions", () => {
expect(response.data.data.invalid[0]).toBe(transactions[1].id);
});

it.each([3, 5, 8])("should accept and broadcast %i transactions emptying a wallet", async txNumber => {
it.each([3, 5, 8])("should accept and broadcast %i transactions emptying a wallet", async (txNumber) => {
const sender = delegates[txNumber]; // use txNumber so that we use a different delegate for each test case
const receivers = generateWallets(2);
const amountPlusFee = Math.floor(+sender.balance / txNumber);
Expand All @@ -730,16 +730,18 @@ describe("API 2.0 - Transactions", () => {

expect(response).toBeSuccessfulResponse();

expect(response.data.data.accept.sort()).toEqual(allTransactions.map(transaction => transaction.id).sort());
expect(response.data.data.accept.sort()).toEqual(
allTransactions.map((transaction) => transaction.id).sort(),
);
expect(response.data.data.broadcast.sort()).toEqual(
allTransactions.map(transaction => transaction.id).sort(),
allTransactions.map((transaction) => transaction.id).sort(),
);
expect(response.data.data.invalid).toHaveLength(0);
});

it.each([3, 5, 8])(
"should not accept the last of %i transactions emptying a wallet when the last one is 1 satoshi too much",
async txNumber => {
async (txNumber) => {
const sender = delegates[txNumber + 1]; // use txNumber + 1 so that we don't use the same delegates as the above test
const receivers = generateWallets(2);
const amountPlusFee = Math.floor(+sender.balance / txNumber);
Expand Down Expand Up @@ -769,12 +771,12 @@ describe("API 2.0 - Transactions", () => {
expect(response).toBeSuccessfulResponse();

expect(response.data.data.accept.sort()).toEqual(
transactions.map(transaction => transaction.id).sort(),
transactions.map((transaction) => transaction.id).sort(),
);
expect(response.data.data.broadcast.sort()).toEqual(
transactions.map(transaction => transaction.id).sort(),
transactions.map((transaction) => transaction.id).sort(),
);
expect(response.data.data.invalid).toEqual(lastTransaction.map(transaction => transaction.id));
expect(response.data.data.invalid).toEqual(lastTransaction.map((transaction) => transaction.id));
},
);
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/core-api/handlers/wallets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ describe("API 2.0 - Wallets", () => {
api.expectWallet(wallet);
}

const addresses = response.data.data.map(wallet => wallet.address).sort();
const addresses = response.data.data.map((wallet) => wallet.address).sort();
expect(addresses).toEqual([address, address2]);
});

Expand Down
12 changes: 3 additions & 9 deletions __tests__/unit/core-api/__support__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,17 @@ export const initApp = (): Application => {

app.bind(Container.Identifiers.BlockRepository).toConstantValue(Mocks.BlockRepository.instance);

app.bind(Container.Identifiers.TransactionRepository).toConstantValue(
Mocks.TransactionRepository.instance,
);
app.bind(Container.Identifiers.TransactionRepository).toConstantValue(Mocks.TransactionRepository.instance);

app.bind(Container.Identifiers.PeerNetworkMonitor).toConstantValue(Mocks.NetworkMonitor.instance);

app.bind(Container.Identifiers.PeerStorage).toConstantValue(Mocks.PeerStorage.instance);

app.bind(Container.Identifiers.RoundRepository).toConstantValue(Mocks.RoundRepository.instance);

app.bind(Container.Identifiers.TransactionPoolQuery).toConstantValue(
Mocks.TransactionPoolQuery.instance,
);
app.bind(Container.Identifiers.TransactionPoolQuery).toConstantValue(Mocks.TransactionPoolQuery.instance);

app.bind(Container.Identifiers.TransactionPoolProcessor).toConstantValue(
Mocks.TransactionPoolProcessor.instance,
);
app.bind(Container.Identifiers.TransactionPoolProcessor).toConstantValue(Mocks.TransactionPoolProcessor.instance);

app.bind(Container.Identifiers.TransactionPoolProcessorFactory).toFactory(() => () => {
return Mocks.TransactionPoolProcessor.instance;
Expand Down
4 changes: 1 addition & 3 deletions __tests__/unit/core-api/resources/ports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ beforeEach(() => {
app = initApp();

app.unbind(Identifiers.ServiceProviderRepository);
app.bind(Identifiers.ServiceProviderRepository).toConstantValue(
Mocks.ServiceProviderRepository.instance,
);
app.bind(Identifiers.ServiceProviderRepository).toConstantValue(Mocks.ServiceProviderRepository.instance);
});

beforeEach(() => {
Expand Down
Loading

0 comments on commit e6d579d

Please sign in to comment.