mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 04:55:44 +00:00
test: dedupe synology chat client timer setup
This commit is contained in:
@@ -51,7 +51,7 @@ function mockFailureResponse(statusCode = 500) {
|
|||||||
mockResponse(statusCode, "error");
|
mockResponse(statusCode, "error");
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("sendMessage", () => {
|
function installFakeTimerHarness() {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
vi.useFakeTimers();
|
vi.useFakeTimers();
|
||||||
@@ -62,6 +62,10 @@ describe("sendMessage", () => {
|
|||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
vi.useRealTimers();
|
vi.useRealTimers();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("sendMessage", () => {
|
||||||
|
installFakeTimerHarness();
|
||||||
|
|
||||||
it("returns true on successful send", async () => {
|
it("returns true on successful send", async () => {
|
||||||
mockSuccessResponse();
|
mockSuccessResponse();
|
||||||
@@ -86,16 +90,7 @@ describe("sendMessage", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("sendFileUrl", () => {
|
describe("sendFileUrl", () => {
|
||||||
beforeEach(() => {
|
installFakeTimerHarness();
|
||||||
vi.clearAllMocks();
|
|
||||||
vi.useFakeTimers();
|
|
||||||
fakeNowMs += 10_000;
|
|
||||||
vi.setSystemTime(fakeNowMs);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
vi.useRealTimers();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("returns true on success", async () => {
|
it("returns true on success", async () => {
|
||||||
mockSuccessResponse();
|
mockSuccessResponse();
|
||||||
|
|||||||
Reference in New Issue
Block a user