Plans: wznawianie planu tylko dla wlasciciela (usuniete akcje trenera)
This commit is contained in:
@@ -167,6 +167,16 @@ describe('draft-only rules', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('reopenPlan: rejects reopening a plan owned by another user with 404', async () => {
|
||||
const { prisma } = mockPrisma();
|
||||
prisma.trainingPlan.findUnique.mockResolvedValue({ ...draftPlan, status: 'COMPLETED' });
|
||||
await expect(reopenPlan(prisma, 'p1', 'trainer1')).rejects.toMatchObject({
|
||||
status: 404,
|
||||
message: 'Plan not found',
|
||||
});
|
||||
expect(prisma.trainingPlan.update).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('reopenPlan: rejects when the owner has another active plan with 409', async () => {
|
||||
const { prisma } = mockPrisma();
|
||||
prisma.trainingPlan.findUnique.mockResolvedValue({ ...draftPlan, status: 'COMPLETED' });
|
||||
|
||||
Reference in New Issue
Block a user