Skip to content

Commit

Permalink
Fixed flaky test
Browse files Browse the repository at this point in the history
Signed-off-by: Guian Gumpac <guian.gumpac@improving.com>
  • Loading branch information
GumpacG committed Aug 1, 2024
1 parent c9905a1 commit e9a6bd0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions node/tests/SharedTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5911,11 +5911,8 @@ export function runBaseTests<Context>(config: {

// Setup test data - use a large number of entries to force an iterative cursor.
const numberMap: Record<string, number> = {};
const expectedNumberMapArray: string[] = [];

for (let i = 0; i < 20000; i++) {
expectedNumberMapArray.push(i.toString());
expectedNumberMapArray.push(i.toString());
for (let i = 0; i < 50000; i++) {
numberMap[i.toString()] = i;
}

Expand Down Expand Up @@ -5988,15 +5985,18 @@ export function runBaseTests<Context>(config: {
}

// Fetching by cursor is randomized.
const expectedCombinedMapArray =
expectedNumberMapArray.concat(expectedCharMapArray);
const expectedFullMap: Record<string, number> = {
...numberMap,
...charMap,
};

expect(fullResultMapArray.length).toEqual(
expectedCombinedMapArray.length,
Object.keys(expectedFullMap).length * 2,
);

for (let i = 0; i < fullResultMapArray.length; i += 2) {
expect(fullResultMapArray).toContain(
expectedCombinedMapArray[i],
expect(fullResultMapArray[i] in expectedFullMap).toEqual(
true,
);
}

Expand Down

0 comments on commit e9a6bd0

Please sign in to comment.