Skip to content

Commit c914adf

Browse files
test: fix stability (#2119)
1 parent a703004 commit c914adf

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/middleware.test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5316,20 +5316,20 @@ describe.each([
53165316
const response = await req.get("/bundle.js");
53175317

53185318
expect(response.statusCode).toBe(200);
5319-
expect(response.headers.etag).toBe(
5320-
/* cspell:disable-next-line */
5321-
'"191a-fDcjg9fXC+4k9zvx46niAuR6C14"',
5322-
);
5319+
expect(response.headers.etag).toBeDefined();
5320+
expect(
5321+
/[0-9a-f]{1,}-[0-9a-z+/=]{27}/i.test(response.headers.etag),
5322+
).toBe(true);
53235323
});
53245324

53255325
it('should return the "200" code for the "GET" request to the file.txt and set strong etag on empty file', async () => {
53265326
const response = await req.get("/file.txt");
53275327

53285328
expect(response.statusCode).toBe(200);
5329-
expect(response.headers.etag).toBe(
5330-
/* cspell:disable-next-line */
5331-
'"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"',
5332-
);
5329+
expect(response.headers.etag).toBeDefined();
5330+
expect(
5331+
/[0-9a-f]{1,}-[0-9a-z+/=]{27}/i.test(response.headers.etag),
5332+
).toBe(true);
53335333
});
53345334

53355335
it('should return the "200" code for the "GET" request with the valid range header and wrong "If-Range" header', async () => {
@@ -5378,10 +5378,10 @@ describe.each([
53785378
const response = await req.get("/bundle.js");
53795379

53805380
expect(response.statusCode).toBe(200);
5381-
expect(response.headers.etag).toBe(
5382-
/* cspell:disable-next-line */
5383-
'"191a-fDcjg9fXC+4k9zvx46niAuR6C14"',
5384-
);
5381+
expect(response.headers.etag).toBeDefined();
5382+
expect(
5383+
/[0-9a-f]{1,}-[0-9a-z+/=]{27}/i.test(response.headers.etag),
5384+
).toBe(true);
53855385
});
53865386
});
53875387

0 commit comments

Comments
 (0)