Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0237h committed Apr 29, 2024
1 parent fcc925a commit ee6df6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
getTransfers,
addAmountFilter,
} from "./queries.js";
import { config } from "./config.js";

const contract = "eosio.token";
const account = "push.sx";
Expand Down Expand Up @@ -65,7 +64,7 @@ test("getTotalSupply", () => {
)
);
expect(query).toContain(formatSQL(`ORDER BY block_number DESC`));
expect(query).toContain(formatSQL(`LIMIT ${config.maxLimit}`));
expect(query).toContain(formatSQL(`LIMIT 1`));
});

test("getTotalSupply with options", () => {
Expand Down Expand Up @@ -99,7 +98,7 @@ test("getBalanceChange", () => {
)
);
expect(query).toContain(formatSQL(`ORDER BY timestamp DESC`));
expect(query).toContain(formatSQL(`LIMIT ${config.maxLimit}`));
expect(query).toContain(formatSQL(`LIMIT 1`));
});

test("getBalanceChanges with options", () => {
Expand Down Expand Up @@ -133,6 +132,6 @@ test("getTransfers", () => {
AND from == '${account}' AND to == '${account}' AND transaction == '${transaction_id}')`
)
);
expect(query).toContain(formatSQL(`ORDER BY timestamp DESC`));
expect(query).toContain(formatSQL(`LIMIT ${config.maxLimit}`));
expect(query).toContain(formatSQL(`ORDER BY block_num DESC`));
expect(query).toContain(formatSQL(`LIMIT 1`));
});
2 changes: 1 addition & 1 deletion src/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test("parseBlockId", () => {

test("parseLimit", () => {
expect(parseLimit("1")).toBe(1);
expect(parseLimit("0")).toBe(0);
expect(parseLimit("0")).toBe(1);
expect(parseLimit(10)).toBe(10);
expect(parseLimit(config.maxLimit + 1)).toBe(config.maxLimit);
});
Expand Down

0 comments on commit ee6df6b

Please sign in to comment.