Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
"@testing-library/user-event": "^14.5.2",
"@tsconfig/node22": "^22.0.2",
"@types/classnames": "^2.2.11",
"@types/enzyme": "^3.10.8",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/fs-extra": "^9.0.7",
"@types/getos": "^3.0.1",
"@types/node": "^22.19.1",
Expand All @@ -116,9 +114,6 @@
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.1",
"electron": "^40.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.7",
"enzyme-to-json": "^3.6.1",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
Expand Down
8 changes: 5 additions & 3 deletions rtl-spec/components/commands-address-bar.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { render } from '@testing-library/react';
import { render, waitFor } from '@testing-library/react';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these tests needed to be changed once Enzyme went out the window, which is a little counter-intuitive: removing the Enzyme adapter config and snapshot serializer from tests/setup.ts and vitest.config.ts affected timing here, hence the changes in these two files.

I have not yet moved the files over, I suspect we want to do that post-merge.

import { userEvent } from '@testing-library/user-event';
import { runInAction } from 'mobx';
import { beforeEach, describe, expect, it } from 'vitest';
Expand Down Expand Up @@ -76,7 +76,9 @@ describe('AddressBar component', () => {
runInAction(() => {
store.activeGistAction = action;
});
const btn = getByRole('button');
expect(btn).toBeDisabled();
await waitFor(() => {
const btn = getByRole('button');
expect(btn).toBeDisabled();
});
});
});
13 changes: 9 additions & 4 deletions rtl-spec/components/commands-publish-button.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Octokit } from '@octokit/rest';
import { act, waitFor } from '@testing-library/react';
import { beforeEach, describe, expect, it, vi } from 'vitest';

import {
Expand Down Expand Up @@ -273,7 +274,7 @@ describe('Action button component', () => {
// create a button that's primed to update gistId
state.gistId = gistId;
({ instance } = createActionButton());
instance.setState({ actionType: GistActionType.update });
act(() => instance.setState({ actionType: GistActionType.update }));

mocktokit.gists.get.mockImplementation(() => {
return {
Expand Down Expand Up @@ -316,7 +317,7 @@ describe('Action button component', () => {

// create a button primed to delete gistId
({ instance } = createActionButton());
instance.setState({ actionType: GistActionType.delete });
act(() => instance.setState({ actionType: GistActionType.delete }));
});

it('attempts to delete an existing Gist', async () => {
Expand Down Expand Up @@ -350,10 +351,14 @@ describe('Action button component', () => {
expect(container.querySelector('fieldset')).not.toBeDisabled();

state.activeGistAction = gistActionState;
expect(container.querySelector('fieldset')).toBeDisabled();
await waitFor(() => {
expect(container.querySelector('fieldset')).toBeDisabled();
});

state.activeGistAction = GistActionState.none;
expect(container.querySelector('fieldset')).not.toBeDisabled();
await waitFor(() => {
expect(container.querySelector('fieldset')).not.toBeDisabled();
});
}

it('while publishing', async () => {
Expand Down
112 changes: 0 additions & 112 deletions tests/renderer/components/__snapshots__/commands-spec.tsx.snap

This file was deleted.

This file was deleted.

Loading
Loading