test for single, aswell as multiple IDs
This commit is contained in:
@@ -120,11 +120,22 @@ describe('Rows Endpoints', () => {
|
|||||||
|
|
||||||
it('GET /tables/:name/rows: should return values if any of the IDs from the array match the user ID.', async () => {
|
it('GET /tables/:name/rows: should return values if any of the IDs from the array match the user ID.', async () => {
|
||||||
const res = await requestWithSupertest.get(
|
const res = await requestWithSupertest.get(
|
||||||
'/api/tables/users/rows?_filters=id:[1,2,3]'
|
'/api/tables/users/rows?_filters=id:[2,3]'
|
||||||
);
|
);
|
||||||
expect(res.status).toEqual(200);
|
expect(res.status).toEqual(200);
|
||||||
expect(res.body).toHaveProperty('data');
|
expect(res.body).toHaveProperty('data');
|
||||||
expect(res.body.data).toEqual(expect.any(Array));
|
expect(res.body.data).toEqual(expect.any(Array));
|
||||||
|
expect(res.body.data.length).toEqual(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('GET /tables/:name/rows: should return values if the provided ID matches the user ID.', async () => {
|
||||||
|
const res = await requestWithSupertest.get(
|
||||||
|
'/api/tables/users/rows?_filters=id:2'
|
||||||
|
);
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
expect(res.body).toHaveProperty('data');
|
||||||
|
expect(res.body.data).toEqual(expect.any(Array));
|
||||||
|
expect(res.body.data.length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user