mirror of https://github.com/openclaw/openclaw.git
test: dedupe synology chat client timer setup
This commit is contained in:
parent
853999fd7f
commit
b9f0effd55
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue