Skip to content

refactor(core-api): remove search endpoints #4067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions __tests__/integration/core-api/controllers/delegates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,3 @@ describe("/delegates", () => {
}
});
});

describe("/delegates/search", () => {
it("should return 10th, 11th, 12th ranked delegates", async () => {
const client = app.resolve(ApiInjectClient);
const response = await client.post("/delegates/search?orderBy=rank:asc", {
rank: [10, 11, 12],
});

expect(response).toMatchObject({
status: 200,
body: {
data: expect.toBeArray(),
},
});

const delegates = response.body.data;

expect(delegates.length).toBe(3);
expect(delegates[0].rank).toBe(10);
expect(delegates[1].rank).toBe(11);
expect(delegates[2].rank).toBe(12);
});
});
57 changes: 0 additions & 57 deletions __tests__/integration/core-api/controllers/wallets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,60 +96,3 @@ describe("/wallets/:id", () => {
});
});
});

describe("/wallets/search", () => {
it("should return 3 wallets with delegate username genesis_1 or genesis_2 or genesis_3", async () => {
const client = app.resolve(ApiInjectClient);
const response = await client.post("/wallets/search?orderBy=attributes.delegate.username", {
attributes: {
delegate: {
username: ["genesis_1", "genesis_2", "genesis_3"],
},
},
});

expect(response).toMatchObject({
status: 200,
body: {
data: expect.toBeArray(),
},
});

const wallets = response.body.data;

expect(wallets.length).toBe(3);
expect(wallets[0].attributes.delegate.username).toBe("genesis_1");
expect(wallets[1].attributes.delegate.username).toBe("genesis_2");
expect(wallets[2].attributes.delegate.username).toBe("genesis_3");
});

it("should return 5 wallets with delegate rank between 1 and 2, or 10 and 12", async () => {
const client = app.resolve(ApiInjectClient);
const response = await client.post("/wallets/search?orderBy=attributes.delegate.rank", {
attributes: {
delegate: {
rank: [
{ from: 1, to: 2 },
{ from: 10, to: 12 },
],
},
},
});

expect(response).toMatchObject({
status: 200,
body: {
data: expect.toBeArray(),
},
});

const wallets = response.body.data;

expect(wallets.length).toBe(5);
expect(wallets[0].attributes.delegate.rank).toBe(1);
expect(wallets[1].attributes.delegate.rank).toBe(2);
expect(wallets[2].attributes.delegate.rank).toBe(10);
expect(wallets[3].attributes.delegate.rank).toBe(11);
expect(wallets[4].attributes.delegate.rank).toBe(12);
});
});
Loading