Skip to content

Commit

Permalink
implement draft status on board copy
Browse files Browse the repository at this point in the history
  • Loading branch information
uidp committed Nov 27, 2024
1 parent aed45b4 commit 6896568
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,27 @@ describe(`board copy with course relation (api)`, () => {
expect(result).toBeDefined();
});

it('should set draft status on the board copy', async () => {
const { loggedInClient, columnBoardNode } = await setup();

const response = await loggedInClient.post(`${columnBoardNode.id}/copy`);
const body = response.body as CopyApiResponse;

const expectedBody: CopyApiResponse = {
id: expect.any(String),
type: CopyElementType.COLUMNBOARD,
status: CopyStatusEnum.SUCCESS,
destinationId: columnBoardNode.context?.id,
};

expect(body).toEqual(expectedBody);

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const result = await em.findOneOrFail(BoardNodeEntity, body.id!);

expect(result.isVisible).toBe(false);
});

describe('with invalid id', () => {
it('should return status 400', async () => {
const { loggedInClient } = await setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class ColumnBoardCopyService {
);
}
copyStatus.copyEntity.context = params.targetExternalReference;
copyStatus.copyEntity.isVisible = false;
await this.boardNodeService.addRoot(copyStatus.copyEntity);
copyStatus.originalEntity = originalBoard;

Expand Down

0 comments on commit 6896568

Please sign in to comment.