Skip to content

Commit 81456f6

Browse files
committed
Stabilize version range test
1 parent 53d8005 commit 81456f6

1 file changed

Lines changed: 23 additions & 13 deletions

File tree

tests/versions.test.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -251,28 +251,38 @@ describe('versionCommands.update package range selection', () => {
251251
});
252252

253253
test('applies minPackageVersion and maxPackageVersion together', async () => {
254-
postSpy.mockClear();
254+
const appId = 'range-app';
255255

256256
await versionCommands.update({
257257
options: {
258-
appId: '100',
258+
appId,
259259
versionId: '200',
260260
minPackageVersion: '1.1.0',
261261
maxPackageVersion: '1.2.0',
262262
},
263263
});
264264

265-
expect(postSpy).toHaveBeenCalledTimes(2);
266-
expect(postSpy).toHaveBeenNthCalledWith(1, '/app/100/binding', {
267-
versionId: '200',
268-
rollout: undefined,
269-
packageId: '11',
270-
});
271-
expect(postSpy).toHaveBeenNthCalledWith(2, '/app/100/binding', {
272-
versionId: '200',
273-
rollout: undefined,
274-
packageId: '12',
275-
});
265+
const bindingCalls = postSpy.mock.calls.filter(
266+
([url]) => url === `/app/${appId}/binding`,
267+
);
268+
269+
expect(bindingCalls).toHaveLength(2);
270+
expect(bindingCalls[0]).toEqual([
271+
`/app/${appId}/binding`,
272+
{
273+
versionId: '200',
274+
rollout: undefined,
275+
packageId: '11',
276+
},
277+
]);
278+
expect(bindingCalls[1]).toEqual([
279+
`/app/${appId}/binding`,
280+
{
281+
versionId: '200',
282+
rollout: undefined,
283+
packageId: '12',
284+
},
285+
]);
276286
});
277287

278288
test('fails instead of prompting for package id in non-interactive mode', async () => {

0 commit comments

Comments
 (0)