Skip to content

Commit 73481bd

Browse files
committed
normalize user agent version in snapshot tests
1 parent a9ecb1a commit 73481bd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/sso/sso.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,12 @@ describe('SSO', () => {
302302
expect(fetch.mock.calls.length).toEqual(1);
303303

304304
expect(fetchBody()).toMatchSnapshot();
305-
expect(fetchHeaders()).toMatchSnapshot();
305+
const headers = fetchHeaders() as Record<string, string>;
306+
const normalizedHeaders = {
307+
...headers,
308+
'User-Agent': headers['User-Agent'].replace(/\(node\/v[\d.]+\)/, '(node/v18.0.0)')
309+
};
310+
expect(normalizedHeaders).toMatchSnapshot();
306311
expect(accessToken).toBe('01DMEK0J53CVMC32CK5SE0KZ8Q');
307312
expect(profile).toMatchSnapshot();
308313
});
@@ -342,7 +347,12 @@ describe('SSO', () => {
342347
expect(fetch.mock.calls.length).toEqual(1);
343348

344349
expect(fetchBody()).toMatchSnapshot();
345-
expect(fetchHeaders()).toMatchSnapshot();
350+
const headers = fetchHeaders() as Record<string, string>;
351+
const normalizedHeaders = {
352+
...headers,
353+
'User-Agent': headers['User-Agent'].replace(/\(node\/v[\d.]+\)/, '(node/v18.0.0)')
354+
};
355+
expect(normalizedHeaders).toMatchSnapshot();
346356
expect(accessToken).toBe('01DMEK0J53CVMC32CK5SE0KZ8Q');
347357
expect(profile).toMatchSnapshot();
348358
});

0 commit comments

Comments
 (0)