Skip to content

Commit 2f2c699

Browse files
committed
Use better convention in testing asny code.
1 parent c808c23 commit 2f2c699

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

libraries/rush-lib/src/logic/test/ChangeFiles.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ describe(ChangeFiles.name, () => {
4545
changesFolder: changesPath
4646
} as unknown as RushConfiguration);
4747
const expectedPath: string = Path.convertToSlashes(`${changesPath}/change1.json`);
48-
expect(await changeFiles.getAllChangeFilesAsync()).toEqual([expectedPath]);
48+
await expect(changeFiles.getAllChangeFilesAsync()).resolves.toEqual([expectedPath]);
4949
});
5050

5151
it('returns empty array when no change files', async () => {
5252
const changesPath: string = `${__dirname}/noChange`;
5353
const changeFiles: ChangeFiles = new ChangeFiles({
5454
changesFolder: changesPath
5555
} as unknown as RushConfiguration);
56-
expect(await changeFiles.getAllChangeFilesAsync()).toHaveLength(0);
56+
await expect(changeFiles.getAllChangeFilesAsync()).resolves.toHaveLength(0);
5757
});
5858

5959
it('returns correctly when change files are categorized', async () => {
@@ -281,7 +281,7 @@ describe(ChangeFiles.name, () => {
281281
const changeFiles: ChangeFiles = new ChangeFiles({
282282
changesFolder: changesPath
283283
} as unknown as RushConfiguration);
284-
expect(await changeFiles.deleteAllAsync(terminal, false)).toEqual(3);
284+
await expect(changeFiles.deleteAllAsync(terminal, false)).resolves.toEqual(3);
285285
});
286286

287287
it('does not delete change files for package whose change logs do not get updated. ', async () => {
@@ -299,15 +299,15 @@ describe(ChangeFiles.name, () => {
299299
entries: []
300300
}
301301
];
302-
expect(await changeFiles.deleteAllAsync(terminal, false, updatedChangelogs)).toEqual(2);
302+
await expect(changeFiles.deleteAllAsync(terminal, false, updatedChangelogs)).resolves.toEqual(2);
303303
});
304304

305305
it('delete all files when there are hotfixes', async () => {
306306
const changesPath: string = `${__dirname}/multipleHotfixChanges`;
307307
const changeFiles: ChangeFiles = new ChangeFiles({
308308
changesFolder: changesPath
309309
} as unknown as RushConfiguration);
310-
expect(await changeFiles.deleteAllAsync(terminal, false)).toEqual(3);
310+
await expect(changeFiles.deleteAllAsync(terminal, false)).resolves.toEqual(3);
311311
});
312312
});
313313
});

0 commit comments

Comments
 (0)