Skip to content

Commit 141117f

Browse files
committed
production: * serialize input for stringContaining method in backend tests
1 parent edb7b2d commit 141117f

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

server/tests/api/7-show-hide-own-posts/post.api.spec.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ describe(`${postApiPath} routes`, () => {
9696
});
9797

9898
expect(response.statusCode).toBe(HttpCode.OK);
99-
expect(response.json()).toEqual([
100-
expect.objectContaining({
101-
userId: expect.not.stringContaining(userId)
102-
})
103-
]);
99+
expect(response.json()).toEqual(
100+
expect.arrayContaining([
101+
expect.objectContaining({
102+
userId: expect.not.stringContaining(userId.toString())
103+
})
104+
])
105+
);
104106
});
105107

106108
it(`should return ${HttpCode.OK} with all users' posts`, async () => {
@@ -114,14 +116,14 @@ describe(`${postApiPath} routes`, () => {
114116
});
115117

116118
expect(response.statusCode).toBe(HttpCode.OK);
117-
expect(response.json()).toEqual([
118-
expect.objectContaining({
119-
userId: expect.not.stringContaining(userId)
120-
}),
121-
expect.objectContaining({
122-
userId
123-
})
124-
]);
119+
expect(response.json()).toEqual(
120+
expect.arrayContaining([
121+
expect.objectContaining({
122+
userId: expect.not.stringContaining(userId.toString())
123+
}),
124+
expect.objectContaining({ userId })
125+
])
126+
);
125127
});
126128
});
127129
});

server/tests/api/8-show-liked-by-own-posts/post.api.spec.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,14 @@ describe(`${postApiPath} routes`, () => {
111111
});
112112

113113
expect(response.statusCode).toBe(HttpCode.OK);
114-
expect(response.json()).toEqual([
115-
expect.objectContaining({
116-
userId: expect.not.stringContaining(userId)
117-
}),
118-
expect.objectContaining({ userId })
119-
]);
114+
expect(response.json()).toEqual(
115+
expect.arrayContaining([
116+
expect.objectContaining({
117+
userId: expect.not.stringContaining(userId.toString())
118+
}),
119+
expect.objectContaining({ userId })
120+
])
121+
);
120122
});
121123
});
122124
});

0 commit comments

Comments
 (0)