From c83cd9faf5f1de957c0905964d8e44ee6b376003 Mon Sep 17 00:00:00 2001 From: Li Zhineng Date: Wed, 23 Jul 2025 21:27:12 +0800 Subject: specify timeout --- tests/index.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/index.test.ts b/tests/index.test.ts index c8e0a64..9e1d4ff 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -318,6 +318,16 @@ describe('HTTP Client', () => { ) }) + it('can customize timeout in milliseconds', () => { + const factory = new Factory() + factory.new().timeout(5000).get('http://example.com') + expect(wx.request).toHaveBeenCalledWith( + expect.objectContaining({ + timeout: 5000 + }) + ) + }) + describe('middleware', () => { it('should be applied', () => { const middleware = jest.fn((request, next) => next(request)) -- cgit v1.2.3