Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktoriia committed Oct 11, 2023
1 parent 21223cb commit e4696ec
Showing 1 changed file with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe("ElementTypeSelection Composable", () => {
env: Partial<Envs> = {
FEATURE_COLUMN_BOARD_SUBMISSIONS_ENABLED: true,
FEATURE_COLUMN_BOARD_EXTERNAL_TOOLS_ENABLED: true,
FEATURE_TLDRAW_ENABLED: false,
FEATURE_TLDRAW_ENABLED: true,
}
) => {
const addElementMock = jest.fn();
Expand Down Expand Up @@ -241,35 +241,35 @@ describe("ElementTypeSelection Composable", () => {
expect(closeDialogMock).toBeCalledTimes(1);
});
});
// describe("when the DrawingElement action is called", () => {
// it("should call drawing element function with right argument", async () => {
// const { elementTypeOptions, addElementMock } = setup();
// const { askType } = useAddElementDialog(addElementMock, {
// value: { elements: [] },
// });
describe("when the DrawingElement action is called", () => {
it("should call drawing element function with right argument", async () => {
const { elementTypeOptions, addElementMock } = setup();
const { askType } = useAddElementDialog(addElementMock, {
value: { elements: [] },
});

// askType();
askType();

// const action = elementTypeOptions.value[4].action;
// action();
const action = elementTypeOptions.value[4].action;
action();

// expect(addElementMock).toBeCalledTimes(1);
// expect(addElementMock).toBeCalledWith(ContentElementType.Drawing);
// });
expect(addElementMock).toBeCalledTimes(1);
expect(addElementMock).toBeCalledWith(ContentElementType.Drawing);
});

// it("should set isDialogOpen to false", async () => {
// const { elementTypeOptions, addElementMock, closeDialogMock } = setup();
// const { askType } = useAddElementDialog(addElementMock, {
// value: { elements: [] },
// });
it("should set isDialogOpen to false", async () => {
const { elementTypeOptions, addElementMock, closeDialogMock } = setup();
const { askType } = useAddElementDialog(addElementMock, {
value: { elements: [] },
});

// askType();
askType();

// const action = elementTypeOptions.value[4].action;
// action();
const action = elementTypeOptions.value[4].action;
action();

// expect(closeDialogMock).toBeCalledTimes(1);
// });
// });
expect(closeDialogMock).toBeCalledTimes(1);
});
});
});
});

0 comments on commit e4696ec

Please sign in to comment.