Skip to content

Commit 2d735cd

Browse files
Update with compound id test
1 parent 465a613 commit 2d735cd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/server/tests/api/rest.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,27 @@ describe('REST server tests', () => {
17681768
expect(r.body.errors[0].code).toBe('invalid-payload');
17691769
});
17701770

1771+
it('update item with compound id', async () => {
1772+
await prisma.user.create({ data: { myId: 'user1', email: '[email protected]' } });
1773+
await prisma.post.create({ data: { id: 1, title: 'Post1' } });
1774+
await prisma.postLike.create({ data: { userId: 'user1', postId: 1, superLike: false } });
1775+
1776+
const r = await handler({
1777+
method: 'put',
1778+
path: `/postLike/1${idDivider}user1`,
1779+
query: {},
1780+
requestBody: {
1781+
data: {
1782+
type: 'postLike',
1783+
attributes: { superLike: true },
1784+
},
1785+
},
1786+
prisma,
1787+
});
1788+
1789+
expect(r.status).toBe(200);
1790+
});
1791+
17711792
it('update a single relation', async () => {
17721793
await prisma.user.create({ data: { myId: 'user1', email: '[email protected]' } });
17731794
await prisma.post.create({

0 commit comments

Comments
 (0)