Skip to content

Commit

Permalink
s/toStrictEqual/toEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
lolopinto committed Sep 5, 2023
1 parent 387c372 commit 51536ba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
8 changes: 4 additions & 4 deletions ts/src/core/loaders/assoc_edge_loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function commonTests() {
const edges = await loader.load(user.id);
const twoWay = await loader.loadTwoWay(user.id);
// TODO need to flip the edges probably. shouldn't have the source id always be id2 here...
expect(twowayIds.sort()).toStrictEqual(twoWay.map((e) => e.id1).sort());
expect(twowayIds.sort()).toEqual(twoWay.map((e) => e.id1).sort());
expect(edges.length).toBe(10);
expect(twoWay.length).toBe(5);

Expand Down Expand Up @@ -515,7 +515,7 @@ function commonTests() {
const twoWay2 = await loader.loadTwoWay(user.id);

// TODO need to flip the edges probably. shouldn't have the source id always be id2 here...
expect(twowayIds.sort()).toStrictEqual(twoWay2.map((e) => e.id1).sort());
expect(twowayIds.sort()).toEqual(twoWay2.map((e) => e.id1).sort());

// deleted some things here which shouldn't show up here
expect(edges2.length).toBe(8);
Expand All @@ -533,15 +533,15 @@ function commonTests() {
expect(twoWay3.length).toBe(3);

// same ids as second time
expect(twoWay2.map((e) => e.id1).sort()).toStrictEqual(
expect(twoWay2.map((e) => e.id1).sort()).toEqual(
twoWay3.map((e) => e.id1).sort(),
);
} else {
expect(edges3.length).toBe(10);
expect(twoWay3.length).toBe(5);

// same ids as first time
expect(twoWay.map((e) => e.id1).sort()).toStrictEqual(
expect(twoWay.map((e) => e.id1).sort()).toEqual(
twoWay3.map((e) => e.id1).sort(),
);
}
Expand Down
28 changes: 14 additions & 14 deletions ts/src/core/query/shared_assoc_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export function assocTests(ml: MockLogs, global = false) {
for (let i = 0; i < this.dataz.length; i++) {
let data = this.dataz[i];

expect(countMap.get(data[0].id)).toStrictEqual(inputs.length);
expect(countMap.get(data[0].id)).toBe(inputs.length);
}
verifyCountQuery({ numQueries: 3, length: 3 });
}
Expand All @@ -255,7 +255,7 @@ export function assocTests(ml: MockLogs, global = false) {
for (let i = 0; i < this.dataz.length; i++) {
let data = this.dataz[i];

expect(countMap.get(data[0].id)).toStrictEqual(data[1].length);
expect(countMap.get(data[0].id)).toBe(data[1].length);
}
verifyQuery({
length: this.dataz.length,
Expand Down Expand Up @@ -1425,7 +1425,7 @@ export function assocTests(ml: MockLogs, global = false) {
const ids = await getQuery().queryIDs();
const candidates = getCandidateIDs();
expect(ids.length).toBe(candidates.length);
expect(ids.sort()).toStrictEqual(candidates.sort());
expect(ids.sort()).toEqual(candidates.sort());
});

test("count", async () => {
Expand Down Expand Up @@ -1454,7 +1454,7 @@ export function assocTests(ml: MockLogs, global = false) {
const ents = await getQuery().queryEnts();
const candidates = getCandidateIDs().sort();
expect(ents.length).toBe(candidates.length);
expect(ents.map((u) => u.id).sort()).toStrictEqual(candidates.sort());
expect(ents.map((u) => u.id).sort()).toEqual(candidates.sort());
});

test("first", async () => {
Expand Down Expand Up @@ -1510,10 +1510,10 @@ export function assocTests(ml: MockLogs, global = false) {
expect(count).toBe(candidates.length);
expect(edges.length).toBe(candidates.length);
expect(ents.length).toBe(candidates.length);
expect(edges.map((e) => e.id2).sort()).toStrictEqual(
expect(edges.map((e) => e.id2).sort()).toEqual(
candidates.map((u) => u.id).sort(),
);
expect(ents.map((e) => e.id).sort()).toStrictEqual(
expect(ents.map((e) => e.id).sort()).toEqual(
candidates.map((u) => u.id).sort(),
);
});
Expand Down Expand Up @@ -1554,10 +1554,10 @@ export function assocTests(ml: MockLogs, global = false) {
expect(count).toBe(candidates.length);
expect(edges.length).toBe(candidates.length);
expect(ents.length).toBe(candidates.length);
expect(edges.map((e) => e.id2).sort()).toStrictEqual(
expect(edges.map((e) => e.id2).sort()).toEqual(
candidates.map((u) => u.id).sort(),
);
expect(ents.map((e) => e.id).sort()).toStrictEqual(
expect(ents.map((e) => e.id).sort()).toEqual(
candidates.map((u) => u.id).sort(),
);
}
Expand Down Expand Up @@ -1613,7 +1613,7 @@ export function assocTests(ml: MockLogs, global = false) {
expect(count2).toBe(candidates.length);
expect(ids.length).toBe(candidates.length);
expect(ents.length).toBe(candidates.length);
expect(ents.map((e) => e.id).sort()).toStrictEqual(
expect(ents.map((e) => e.id).sort()).toEqual(
candidates.map((u) => u.id).sort(),
);
});
Expand Down Expand Up @@ -1700,7 +1700,7 @@ export function assocTests(ml: MockLogs, global = false) {
const ids = await getQuery().queryIDs();
const candidates = getCandidateIDs();
expect(ids.length).toBe(candidates.length);
expect(ids.sort()).toStrictEqual(candidates.sort());
expect(ids.sort()).toEqual(candidates.sort());
});

test("count", async () => {
Expand Down Expand Up @@ -1801,10 +1801,10 @@ export function assocTests(ml: MockLogs, global = false) {
expect(count).toBe(candidates.length);
expect(edges.length).toBe(candidates.length);
expect(ents.length).toBe(user1Visible.length);
expect(edges.map((e) => e.id2).sort()).toStrictEqual(
expect(edges.map((e) => e.id2).sort()).toEqual(
candidates.map((u) => u.id).sort(),
);
expect(ents.map((e) => e.id).sort()).toStrictEqual(
expect(ents.map((e) => e.id).sort()).toEqual(
user1Visible.map((u) => u.id).sort(),
);
});
Expand Down Expand Up @@ -1864,10 +1864,10 @@ export function assocTests(ml: MockLogs, global = false) {
expect(count).toBe(candidates.length);
expect(edges.length).toBe(candidates.length);
expect(ents.length).toBe(visible.length);
expect(edges.map((e) => e.id2).sort()).toStrictEqual(
expect(edges.map((e) => e.id2).sort()).toEqual(
candidates.map((u) => u.id).sort(),
);
expect(ents.map((e) => e.id).sort()).toStrictEqual(
expect(ents.map((e) => e.id).sort()).toEqual(
visible.map((u) => u.id).sort(),
);
}
Expand Down
6 changes: 2 additions & 4 deletions ts/src/testutils/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ export function getVerifyAfterEachCursorGeneric<

const pagination = query.paginationInfo().get(user.id);
if (hasEdge) {
expect(newEdges[0], `${i}`).toStrictEqual(edges[i]);
expect(newEdges[0], `${i}`).toEqual(edges[i]);
expect(newEdges.length, `${i}`).toBe(
edges.length - i >= pageLength ? pageLength : edges.length - i,
);
// verify items are the same in order
expect(newEdges, `${i}`).toStrictEqual(
edges.slice(i, i + newEdges.length),
);
expect(newEdges, `${i}`).toEqual(edges.slice(i, i + newEdges.length));
} else {
expect(newEdges.length, `${i}`).toBe(0);
}
Expand Down

0 comments on commit 51536ba

Please sign in to comment.