Skip to content

Commit ddcc139

Browse files
committed
Use arrayContaining for keys since the order is not guaranteed
1 parent c205f4e commit ddcc139

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/index.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ describe('keys', () => {
388388
expect(res).toEqual(["OK", "OK"]);
389389
redisCache.keys('*', function (err, res) {
390390
expect(err).toBeNull();
391-
expect(res).toEqual(['foo', 'baz']);
391+
expect(res).toEqual(expect.arrayContaining(['foo', 'baz']));
392392
done();
393393
});
394394
})
@@ -403,6 +403,7 @@ describe('keys', () => {
403403
it('should return an array of all keys if called without a pattern', async () => {
404404
await redisCache.mset('foo', 'bar', 'foo2', 'bar2', 'foo3', 'bar3');
405405
await expect(redisCache.keys()).resolves.toHaveLength(3);
406+
await expect(redisCache.keys()).resolves.toEqual(expect.arrayContaining(['foo', 'foo2', 'foo3']));
406407
});
407408

408409
it('should return an error if there is an error acquiring a connection', async () => {

0 commit comments

Comments
 (0)