Skip to content

Commit

Permalink
Macro: #3598- Fix CI test command and unit tests (#3586)
Browse files Browse the repository at this point in the history
* fix test command
* fix unit tests
  • Loading branch information
StarlaStarla authored Nov 28, 2023
1 parent fd2a633 commit 19f730e
Show file tree
Hide file tree
Showing 27 changed files with 817 additions and 1,719 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"build:packages": "npm run build:core && run-p build:standalone build:react && npm run build:polymer-editor",
"build:example": "npm run build -w example",
"build:demo": "npm run build:packages && npm run build -w demo",
"test": "npm run test --workspace=packages/ketcher-core --workspace=packages/ketcher-react --workspace=packages/ketcher-standalone --workspace=packages/ketcher-standalone",
"test": "npm run test --workspace=packages/ketcher-core --workspace=packages/ketcher-react --workspace=packages/ketcher-standalone --workspace=packages/ketcher-polymer-editor-react",
"check:autotests": "cd ketcher-autotests && npm run check:code",
"serve:remote": "cd example && npm run serve:remote",
"serve:standalone": "cd example && npm run serve:standalone",
Expand Down
30 changes: 0 additions & 30 deletions packages/ketcher-polymer-editor-react/src/Editor.test.tsx

This file was deleted.

1,068 changes: 0 additions & 1,068 deletions packages/ketcher-polymer-editor-react/src/__snapshots__/Editor.test.tsx.snap

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ describe('RNA ContextMenu', () => {
},
),
);
const cancelButton = screen.getByTestId('cancel-btn');
fireEvent.click(cancelButton);
const presetCard = screen.getByTestId('A_A_R_P');
fireEvent.contextMenu(presetCard);
expect(screen.getByTestId('deletepreset')).toBeInTheDocument();
Expand All @@ -96,15 +94,13 @@ describe('RNA ContextMenu', () => {
},
),
);
const cancelButton = screen.getByTestId('cancel-btn');
fireEvent.click(cancelButton);
const preset = screen.getByTestId('A_A_R_P');
fireEvent.contextMenu(preset);
const deleteMenu = screen.getByTestId('deletepreset');
expect(deleteMenu.className).toContain('disabled');
});

it("should delete preset correctly when click menu 'Delete Preset'", () => {
it("should enable 'Delete Preset' when trying to delete non-default preset", () => {
render(
withThemeAndStoreProvider(
<div>
Expand All @@ -120,18 +116,9 @@ describe('RNA ContextMenu', () => {
},
),
);
const cancelButton = screen.getByTestId('cancel-btn');
fireEvent.click(cancelButton);
const preset = screen.getByTestId('A_A_R_P');
fireEvent.contextMenu(preset);
const duplicateMenu = screen.getByTestId('duplicateandedit');
fireEvent.click(duplicateMenu);
const presetCopyCard = screen.getByTestId('A_Copy_A_R_P');
fireEvent.contextMenu(presetCopyCard);
const deleteMenu = screen.getByTestId('deletepreset');
fireEvent.click(deleteMenu);
const deleteBtn = screen.getByTitle('Delete');
fireEvent.click(deleteBtn);
expect(presetCopyCard).not.toBeInTheDocument();
expect(deleteMenu.className).toContain('disabled');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ Object {
"baseElement": <body>
<div>
<div
class="css-1t7fvih"
class="css-198rm13"
>
<div
class="css-10qeqvw"
>
<button
class="css-1nruub0"
class="open css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand All @@ -33,7 +34,8 @@ Object {
class="css-10qeqvw"
>
<button
class="css-1nruub0"
class="erase css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand All @@ -56,7 +58,8 @@ Object {
class="css-5su45f"
>
<button
class="css-1nruub0"
class="select-lasso css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand Down Expand Up @@ -96,7 +99,8 @@ Object {
class="css-5su45f"
>
<button
class="css-1nruub0"
class="shape-rectangle css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand Down Expand Up @@ -132,7 +136,8 @@ Object {
class="css-5su45f"
>
<button
class="css-1nruub0"
class="transform-flip-h css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand Down Expand Up @@ -167,13 +172,14 @@ Object {
</body>,
"container": <div>
<div
class="css-1t7fvih"
class="css-198rm13"
>
<div
class="css-10qeqvw"
>
<button
class="css-1nruub0"
class="open css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand All @@ -194,7 +200,8 @@ Object {
class="css-10qeqvw"
>
<button
class="css-1nruub0"
class="erase css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand All @@ -217,7 +224,8 @@ Object {
class="css-5su45f"
>
<button
class="css-1nruub0"
class="select-lasso css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand Down Expand Up @@ -257,7 +265,8 @@ Object {
class="css-5su45f"
>
<button
class="css-1nruub0"
class="shape-rectangle css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand Down Expand Up @@ -293,7 +302,8 @@ Object {
class="css-5su45f"
>
<button
class="css-1nruub0"
class="transform-flip-h css-1odf3mo"
title=""
>
<svg
class="css-uwwqev"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Delete component', () => {
render(
withThemeAndStoreProvider(<Delete {...mockProps} />, {
rnaBuilder: {
activePreset: { presetInList: preset, name: 'name' },
activePresetForContextMenu: { presetInList: preset, name: 'name' },
presets: [preset],
},
}),
Expand All @@ -53,7 +53,7 @@ describe('Delete component', () => {
render(
withThemeAndStoreProvider(<Delete {...mockProps} />, {
rnaBuilder: {
activePreset: { presetInList: preset, name: 'name' },
activePresetForContextMenu: { presetInList: preset, name: 'name' },
presets: [preset],
},
}),
Expand All @@ -67,7 +67,7 @@ describe('Delete component', () => {
render(
withThemeAndStoreProvider(<Delete {...mockProps} />, {
rnaBuilder: {
activePreset: { presetInList: preset, name: 'name' },
activePresetForContextMenu: { presetInList: preset, name: 'name' },
presets: [preset],
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Object {
aria-hidden="true"
/>
<div
class="MuiDialog-root MuiModal-root css-zw3mfo-MuiModal-root-MuiDialog-root"
class="MuiDialog-root MuiModal-root css-kxv5da-MuiModal-root-MuiDialog-root"
role="presentation"
>
<div
aria-hidden="true"
class="MuiBackdrop-root MuiModal-backdrop css-yiavyu-MuiBackdrop-root-MuiDialog-backdrop"
style="opacity: 0.4; background: rgb(0, 86, 98); webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;"
style="opacity: 0.4; background: rgba(94, 94, 94, 0.8); webkit-transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;"
/>
<div
data-testid="sentinelStart"
Expand All @@ -30,16 +30,16 @@ Object {
>
<div
aria-labelledby=":r0:"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation24 MuiDialog-paper MuiDialog-paperScrollPaper MuiDialog-paperWidthMd css-12rl710-MuiPaper-root-MuiDialog-paper"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation24 MuiDialog-paper MuiDialog-paperScrollPaper MuiDialog-paperWidthSm css-1t1j96h-MuiPaper-root-MuiDialog-paper"
role="dialog"
style="min-width: 20vw; background: rgb(245, 245, 245); border-radius: 8px; color: rgb(51, 51, 51);"
style="background: rgb(255, 255, 255); border-radius: 8px; color: rgb(51, 51, 51);"
>
<h2
class="MuiTypography-root MuiTypography-h6 MuiDialogTitle-root css-1pbuetl-MuiTypography-root-MuiDialogTitle-root"
class="MuiTypography-root MuiTypography-h6 MuiDialogTitle-root css-o07hi-MuiTypography-root-MuiDialogTitle-root"
id=":r0:"
>
<div
class="css-lvyu5j"
class="css-1uarmuk"
>
Delete RNA Preset
</div>
Expand All @@ -50,6 +50,7 @@ Object {
type="button"
>
<svg
class="css-1td8dcm"
fill="none"
height="24"
viewBox="0 0 24 24"
Expand All @@ -67,28 +68,30 @@ Object {
</button>
</h2>
<div
class="contexify_separator"
/>
<div
class="MuiDialogContent-root css-1n1tez8-MuiDialogContent-root"
class="MuiDialogContent-root css-1wbmh3t-MuiDialogContent-root"
>
<div>
You are about to delete
<div
class="css-pp7hf1"
data-testid="delete-preset-popup-content"
>
<div>
You are about to delete
</div>
<div>
"
name
" RNA preset.
</div>
<div>
This operation cannot be undone.
</div>
</div>
<p>
"
name
" RNA preset.
</p>
<p>
This operation cannot be undone.
</p>
</div>
<div
class="MuiDialogActions-root MuiDialogActions-spacing css-1codpvf-MuiDialogActions-root"
class="MuiDialogActions-root MuiDialogActions-spacing css-1a9359k-MuiDialogActions-root"
>
<button
class="MuiButtonBase-root css-1sac61a-MuiButtonBase-root"
class="MuiButtonBase-root css-1gtlr3p-MuiButtonBase-root"
role="button"
tabindex="0"
title="Cancel"
Expand All @@ -100,7 +103,7 @@ Object {
/>
</button>
<button
class="MuiButtonBase-root css-7phceu-MuiButtonBase-root"
class="MuiButtonBase-root css-1arq8ci-MuiButtonBase-root"
role="button"
tabindex="0"
title="Delete"
Expand Down
Loading

0 comments on commit 19f730e

Please sign in to comment.