Skip to content

Commit

Permalink
refactor(api-http): remove /transaction/feesendpoint (#748)
Browse files Browse the repository at this point in the history
* remove transaction/fees

* Remove integration tests
  • Loading branch information
sebastijankuzner authored Nov 4, 2024
1 parent 8574a37 commit ce343c5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 37 deletions.
29 changes: 6 additions & 23 deletions packages/api-http/integration/routes/transactions.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import { describe, Sandbox } from "../../../test-framework/source";
import { prepareSandbox, ApiContext } from "../../test/helpers/prepare-sandbox";
import { request } from "../../test/helpers/request";

import cryptoJson from "../../../core/bin/config/testnet/core/crypto.json";
import transactions from "../../test/fixtures/transactions.json";
import transactionTypes from "../../test/fixtures/transactions_types.json";
import transactionSchemas from "../../test/fixtures/transactions_schemas.json";
import transactionFees from "../../test/fixtures/transactions_fees.json";
import transactionTypes from "../../test/fixtures/transactions_types.json";
import { ApiContext, prepareSandbox } from "../../test/helpers/prepare-sandbox";
import { request } from "../../test/helpers/request";

describe<{
sandbox: Sandbox;
}>("Transactions", ({ it, afterAll, assert, afterEach, beforeAll, beforeEach, nock }) => {
let apiContext: ApiContext;

// TODO:
let options = { transform: false };
const options = { transform: false };

beforeAll(async (context) => {
nock.enableNetConnect();
Expand Down Expand Up @@ -74,10 +71,10 @@ describe<{
it("/transactions/{id}", async () => {
await apiContext.transactionRepository.save(transactions);

const id = transactions[transactions.length - 1].id;
const id = transactions.at(-1).id;
const { statusCode, data } = await request(`/transactions/${id}`, options);
assert.equal(statusCode, 200);
assert.equal(data.data, transactions[transactions.length - 1]);
assert.equal(data.data, transactions.at(-1));
});

it("/transactions/schemas", async () => {
Expand All @@ -87,18 +84,4 @@ describe<{
assert.equal(statusCode, 200);
assert.equal(data.data, transactionSchemas);
});

it("/transactions/fees", async () => {
await apiContext.transactionTypeRepository.save(transactionTypes);
await apiContext.configurationRepository.save({
activeMilestones: cryptoJson.milestones[0],
cryptoConfiguration: cryptoJson,
id: 1,
version: "0.0.1",
});

const { statusCode, data } = await request(`/transactions/fees`, {});
assert.equal(statusCode, 200);
assert.equal(data.data, transactionFees);
});
});
7 changes: 0 additions & 7 deletions packages/api-http/source/controllers/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ export class TransactionsController extends Controller {
return { data: schemasByKey };
}

// TODO: Remove endpoint
public async fees(request: Hapi.Request) {
const typeGroups: Record<string | number, Record<string, number>> = {};

return { data: typeGroups };
}

private async getTransactionTypes(): Promise<Models.TransactionType[]> {
return this.transactionTypeRepositoryFactory().createQueryBuilder().select().addOrderBy("key", "ASC").getMany();
}
Expand Down
6 changes: 0 additions & 6 deletions packages/api-http/source/routes/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,4 @@ export const register = (server: Contracts.Api.ApiServer): void => {
method: "GET",
path: "/transactions/schemas",
});

server.route({
handler: (request: Hapi.Request) => controller.fees(request),
method: "GET",
path: "/transactions/fees",
});
};
1 change: 0 additions & 1 deletion packages/api-http/test/fixtures/transactions_fees.json

This file was deleted.

0 comments on commit ce343c5

Please sign in to comment.