Skip to content
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

Fixup test types #1326

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
44 changes: 22 additions & 22 deletions packages/core/src/indexing-store/historical.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,42 +78,42 @@ test("insert", async (context) => {

// single

let result: any = await indexingStore
let result = await indexingStore
.insert(schema.account)
.values({ address: zeroAddress, balance: 10n });

expect(result).toStrictEqual({ address: zeroAddress, balance: 10n });

result = await indexingStore.find(schema.account, {
result = (await indexingStore.find(schema.account, {
address: zeroAddress,
});
}))!;

expect(result).toStrictEqual({ address: zeroAddress, balance: 10n });

// multiple

result = await indexingStore.insert(schema.account).values([
const results = await indexingStore.insert(schema.account).values([
{ address: "0x0000000000000000000000000000000000000001", balance: 12n },
{ address: "0x0000000000000000000000000000000000000002", balance: 52n },
]);

expect(result).toStrictEqual([
expect(results).toStrictEqual([
{ address: "0x0000000000000000000000000000000000000001", balance: 12n },
{ address: "0x0000000000000000000000000000000000000002", balance: 52n },
]);

result = await indexingStore.find(schema.account, {
result = (await indexingStore.find(schema.account, {
address: "0x0000000000000000000000000000000000000001",
});
}))!;

expect(result).toStrictEqual({
address: "0x0000000000000000000000000000000000000001",
balance: 12n,
});

result = await indexingStore.find(schema.account, {
result = (await indexingStore.find(schema.account, {
address: "0x0000000000000000000000000000000000000002",
});
}))!;

expect(result).toStrictEqual({
address: "0x0000000000000000000000000000000000000002",
Expand All @@ -122,41 +122,41 @@ test("insert", async (context) => {

// on conflict do nothing

result = await indexingStore
result = (await indexingStore
.insert(schema.account)
.values({
address: "0x0000000000000000000000000000000000000001",
balance: 44n,
})
.onConflictDoNothing();
.onConflictDoNothing())!;

expect(result).toBe(null);

result = await indexingStore.find(schema.account, {
result = (await indexingStore.find(schema.account, {
address: "0x0000000000000000000000000000000000000001",
});
}))!;

expect(result).toStrictEqual({
address: "0x0000000000000000000000000000000000000001",
balance: 12n,
});

result = await indexingStore
const resultsPossiblyNull = await indexingStore
.insert(schema.account)
.values([
{ address: "0x0000000000000000000000000000000000000001", balance: 44n },
{ address: "0x0000000000000000000000000000000000000003", balance: 0n },
])
.onConflictDoNothing();

expect(result).toStrictEqual([
expect(resultsPossiblyNull).toStrictEqual([
null,
{ address: "0x0000000000000000000000000000000000000003", balance: 0n },
]);

result = await indexingStore.find(schema.account, {
result = (await indexingStore.find(schema.account, {
address: "0x0000000000000000000000000000000000000001",
});
}))!;

expect(result).toStrictEqual({
address: "0x0000000000000000000000000000000000000001",
Expand All @@ -175,9 +175,9 @@ test("insert", async (context) => {
balance: 16n,
});

result = await indexingStore.find(schema.account, {
result = (await indexingStore.find(schema.account, {
address: "0x0000000000000000000000000000000000000001",
});
}))!;

expect(result).toStrictEqual({
address: "0x0000000000000000000000000000000000000001",
Expand All @@ -194,9 +194,9 @@ test("insert", async (context) => {
balance: row.balance + 16n,
}));

result = await indexingStore.find(schema.account, {
result = (await indexingStore.find(schema.account, {
address: "0x0000000000000000000000000000000000000001",
});
}))!;

expect(result).toStrictEqual({
address: "0x0000000000000000000000000000000000000001",
Expand Down Expand Up @@ -431,7 +431,7 @@ test("sql", async (context) => {
.insert(schema.account)
.values({
address: "0x0000000000000000000000000000000000000001",
balance: undefined,
balance: undefined as unknown as bigint,
})
.catch((error) => error);

Expand Down
Loading