Skip to content

Commit

Permalink
test: make regexes less strict for unleash version (#698)
Browse files Browse the repository at this point in the history
This fix makes it so that beta versions (e.g. 4.0.6-beta.06) break it.
  • Loading branch information
thomasheartman authored Jan 16, 2025
1 parent b186919 commit b558693
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/test/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ test('should send correct custom and x-unleash headers', (t) =>
const metricsEP = nockMetrics(url)
.matchHeader('randomKey', randomKey)
.matchHeader('x-unleash-appname', 'appName')
.matchHeader('x-unleash-sdk', /^unleash-node@(\d+\.\d+\.\d+)$/)
.matchHeader('x-unleash-sdk', /^unleash-node@\d+\.\d+\.\d+/)
.matchHeader('x-unleash-connection-id', 'connectionId');
const regEP = nockRegister(url)
.matchHeader('randomKey', randomKey)
.matchHeader('x-unleash-appname', 'appName')
.matchHeader('x-unleash-sdk', /^unleash-node@(\d+\.\d+\.\d+)$/)
.matchHeader('x-unleash-sdk', /^unleash-node@\d+\.\d+\.\d+/)
.matchHeader('x-unleash-connection-id', 'connectionId');

// @ts-expect-error
Expand Down
2 changes: 1 addition & 1 deletion src/test/repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ test('should request with correct custom and x-unleash headers', (t) =>
.matchHeader('randomKey', randomKey)
.matchHeader('x-unleash-appname', appName)
.matchHeader('x-unleash-connection-id', connectionId)
.matchHeader('x-unleash-sdk', /^unleash-node@(\d+\.\d+\.\d+)$/)
.matchHeader('x-unleash-sdk', /^unleash-node@\d+\.\d+\.\d+/)
.persist()
.get('/client/features')
.reply(200, { features: [] }, { Etag: '12345-3' });
Expand Down
2 changes: 1 addition & 1 deletion src/test/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ test('Correct headers should be included', (t) => {
t.is(headers['UNLEASH-INSTANCEID'], 'instanceId');
t.is(headers['x-unleash-connection-id'], 'connectionId');
t.is(headers['x-unleash-appname'], 'myApp');
t.regex(headers['x-unleash-sdk'], /^unleash-node@(\d+\.\d+\.\d+)$/);
t.regex(headers['x-unleash-sdk'], /^unleash-node@\d+\.\d+\.\d+/);
});

0 comments on commit b558693

Please sign in to comment.