Skip to content

Commit 527b01b

Browse files
update test
1 parent 5ae6c3a commit 527b01b

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

sdk/tests/network-client.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ describe("NodeConnection", () => {
224224
client.fetchRaw = async () => {
225225
attemptCount++;
226226
console.warn(`fake fetchRaw attempt ${attemptCount}`);
227-
throw new Error("503 Service Unavailable");
227+
throw Object.assign(new Error("503 Service Unavailable"), { status: 503 });
228228
};
229229

230230
try {
@@ -237,25 +237,25 @@ describe("NodeConnection", () => {
237237
});
238238

239239
it("should retry failed transaction submissions and eventually give up", async () => {
240-
const client = new AleoNetworkClient("http://localhost:1234");
241-
242-
let attemptCount = 0;
243-
244-
// @ts-ignore override for testing
245-
client["sendPost"] = async () => {
246-
attemptCount++;
247-
console.warn(`fake sendPost attempt ${attemptCount}`);
248-
throw new Error("503 Service Unavailable");
249-
};
250-
251-
try {
252-
await client.submitTransaction("dummy_tx_string");
253-
throw new Error("Expected submitTransaction to fail");
254-
} catch (err: any) {
255-
expect(err.message).to.include("503");
256-
expect(attemptCount).to.be.greaterThan(1);
257-
}
258-
});
240+
const client = new AleoNetworkClient("http://localhost:1234");
241+
242+
let attemptCount = 0;
243+
244+
// @ts-ignore override for testing
245+
client["sendPost"] = async () => {
246+
attemptCount++;
247+
console.warn(`fake sendPost attempt ${attemptCount}`);
248+
throw Object.assign(new Error("503 Service Unavailable"), { status: 503 });
249+
};
250+
251+
try {
252+
await client.submitTransaction("dummy_tx_string");
253+
throw new Error("Expected submitTransaction to fail");
254+
} catch (err: any) {
255+
expect(err.message).to.include("503");
256+
expect(attemptCount).to.be.greaterThan(1);
257+
}
258+
});
259259
});
260260

261261
describe("setHeader", () => {

0 commit comments

Comments
 (0)