Skip to content

Commit ea12d9a

Browse files
test: align API tests with soft-delete filtering and upload size errors
1 parent bb5c046 commit ea12d9a

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎apps/dashboard-api/src/__tests__/project.controller.softDelete.test.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const mongoose = require('mongoose');
3434
function makeReq() {
3535
return {
3636
params: { projectId: 'proj_1', collectionName: 'posts', id: '507f1f77bcf86cd799439011' },
37-
user: { _id: 'user_1' }
37+
user: { _id: 'user_1' },
38+
query: {}
3839
};
3940
}
4041

‎apps/public-api/src/__tests__/data.controller.read.test.js‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ describe('data.controller read RLS filters', () => {
180180
const res = makeRes();
181181
await getSingleDoc(req, res, next);
182182

183-
expect(mockPopulate).toHaveBeenCalledWith('author');
183+
expect(mockPopulate).toHaveBeenCalledWith({
184+
path: 'author',
185+
match: { isDeleted: { $ne: true } }
186+
});
184187
expect(res.json).toHaveBeenCalled();
185188
});
186189

@@ -189,8 +192,14 @@ describe('data.controller read RLS filters', () => {
189192
const res = makeRes();
190193
await getSingleDoc(req, res, next);
191194

192-
expect(mockPopulate).toHaveBeenCalledWith('author');
193-
expect(mockPopulate).toHaveBeenCalledWith('category');
195+
expect(mockPopulate).toHaveBeenCalledWith({
196+
path: 'author',
197+
match: { isDeleted: { $ne: true } }
198+
});
199+
expect(mockPopulate).toHaveBeenCalledWith({
200+
path: 'category',
201+
match: { isDeleted: { $ne: true } }
202+
});
194203
expect(res.json).toHaveBeenCalled();
195204
expect(next).not.toHaveBeenCalled();
196205
});

‎apps/public-api/src/__tests__/storage.controller.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('storage.controller', () => {
116116

117117
expect(next).toHaveBeenCalledWith(expect.any(AppError));
118118
expect(next.mock.calls[0][0].statusCode).toBe(413);
119-
expect(next.mock.calls[0][0].message).toBe('File size exceeds limit.');
119+
expect(next.mock.calls[0][0].message).toBe('File size exceeds limit of 10MB.');
120120
});
121121

122122
test('returns 403 when internal storage quota is exceeded', async () => {

0 commit comments

Comments
 (0)