Skip to content

Commit bb3ac3d

Browse files
shrugsclaude
andcommitted
test: use await expect(...).resolves for graphnode-helpers assertions (loop)
Converts all success/null result assertions to the await expect(...).resolves form (matching the file's existing .rejects throw-tests), per CodeRabbit and repo convention. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 39723f9 commit bb3ac3d

1 file changed

Lines changed: 17 additions & 21 deletions

File tree

apps/ensindexer/src/lib/graphnode-helpers.test.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ describe("labelByLabelHash", () => {
4949
}),
5050
});
5151

52-
expect(
53-
await labelByLabelHash("0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc"),
54-
).toEqual("vitalik");
52+
await expect(
53+
labelByLabelHash("0xaf2caa1c2ca1d027f1ac823b529d0a67cd144264b2789fa2ea4d63a67c7103cc"),
54+
).resolves.toEqual("vitalik");
5555
});
5656

5757
it("returns null for a valid unknown labelHash", async () => {
@@ -67,9 +67,9 @@ describe("labelByLabelHash", () => {
6767
}),
6868
});
6969

70-
expect(
71-
await labelByLabelHash("0x00ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da06"),
72-
).toBeNull();
70+
await expect(
71+
labelByLabelHash("0x00ca5d0b4ef1129e04bfe7d35ac9def2f4f91daeb202cbe6e613f1dd17b2da06"),
72+
).resolves.toBeNull();
7373
});
7474

7575
it("normalizes a 63-char hex labelHash by prepending '0' and heals it", async () => {
@@ -92,7 +92,7 @@ describe("labelByLabelHash", () => {
9292
}),
9393
});
9494

95-
expect(await labelByLabelHash(labelHash63)).toEqual(DAN_LABEL);
95+
await expect(labelByLabelHash(labelHash63)).resolves.toEqual(DAN_LABEL);
9696

9797
const [[calledUrl]] = (fetch as any).mock.calls;
9898
// Verify the client prepended a '0' — the normalized 64-char hash is used in the request
@@ -136,11 +136,11 @@ describe("labelByLabelHash", () => {
136136
});
137137

138138
// Use a hash distinct from other tests to avoid LRU cache hits suppressing the fetch call
139-
expect(
140-
await labelByLabelHash(
139+
await expect(
140+
labelByLabelHash(
141141
"0x5D5727cb0fb76e4944eafb88ec9a3cf0b3c9025a4b2f947729137c5d7f84f68f" as LabelHash,
142142
),
143-
).toEqual("nick");
143+
).resolves.toEqual("nick");
144144

145145
const [[calledUrl]] = (fetch as any).mock.calls;
146146
expect(calledUrl.toString()).toContain(
@@ -175,9 +175,7 @@ describe("labelByLabelHash", () => {
175175
json: () => Promise.resolve({ status: "success", label }),
176176
});
177177

178-
const result = await labelByLabelHash(labelhashLiteralLabel(label));
179-
180-
expect(result).toEqual(label);
178+
await expect(labelByLabelHash(labelhashLiteralLabel(label))).resolves.toEqual(label);
181179
expect(fetch).toHaveBeenCalledTimes(3);
182180
expect(warnSpy).toHaveBeenCalledTimes(2);
183181
});
@@ -197,9 +195,7 @@ describe("labelByLabelHash", () => {
197195
json: () => Promise.resolve({ status: "success", label }),
198196
});
199197

200-
const result = await labelByLabelHash(labelhashLiteralLabel(label));
201-
202-
expect(result).toEqual(label);
198+
await expect(labelByLabelHash(labelhashLiteralLabel(label))).resolves.toEqual(label);
203199
expect(fetch).toHaveBeenCalledTimes(2);
204200
expect(warnSpy).toHaveBeenCalledTimes(1);
205201
});
@@ -210,11 +206,11 @@ describe("labelByLabelHash", () => {
210206
json: () => Promise.resolve({ status: "error", error: "Label not found", errorCode: 404 }),
211207
});
212208

213-
const result = await labelByLabelHash(
214-
"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" as LabelHash,
215-
);
216-
217-
expect(result).toBeNull();
209+
await expect(
210+
labelByLabelHash(
211+
"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" as LabelHash,
212+
),
213+
).resolves.toBeNull();
218214
expect(fetch).toHaveBeenCalledTimes(1);
219215
});
220216

0 commit comments

Comments
 (0)