Skip to content

Commit

Permalink
refactor(jest): align test suite names to match code under test (giti…
Browse files Browse the repository at this point in the history
  • Loading branch information
setchy authored and adufr committed Mar 25, 2024
1 parent 2617682 commit f8e2ebe
Show file tree
Hide file tree
Showing 20 changed files with 136 additions and 136 deletions.
2 changes: 1 addition & 1 deletion src/components/AllRead.test.tsx
Expand Up @@ -5,7 +5,7 @@ import { mockMathRandom } from './test-utils';

import { AllRead } from './AllRead';

describe('components/all-read.tsx', function () {
describe('components/AllRead.tsx', function () {
// The read emoji randomly rotates, but then the snapshots would never match
// Have to make it consistent so the emojis are always the same
mockMathRandom(0.1);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Loading.test.tsx
Expand Up @@ -12,7 +12,7 @@ jest.mock('nprogress', () => ({
remove: jest.fn(),
}));

describe('components/Loading.js', () => {
describe('components/Loading.tsx', () => {
beforeEach(() => {
jest.clearAllMocks();
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/Logo.test.tsx
Expand Up @@ -4,7 +4,7 @@ import { fireEvent, render } from '@testing-library/react';

import { Logo } from './Logo';

describe('components/ui/logo.tsx', () => {
describe('components/Logo.tsx', () => {
it('renders correctly (light)', () => {
const tree = TestRenderer.create(<Logo />);

Expand Down
2 changes: 1 addition & 1 deletion src/components/NotificationRow.test.tsx
Expand Up @@ -9,7 +9,7 @@ import { mockedSingleNotification } from '../__mocks__/mockedData';
import { NotificationRow } from './NotificationRow';
import { mockAccounts, mockSettings } from '../__mocks__/mock-state';

describe('components/Notification.js', () => {
describe('components/NotificationRow.tsx', () => {
beforeEach(() => {
jest.spyOn(helpers, 'openInBrowser');
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/Oops.test.tsx
Expand Up @@ -5,7 +5,7 @@ import { mockMathRandom } from './test-utils';

import { Oops } from './Oops';

describe('components/oops.tsx', function () {
describe('components/Oops.tsx', function () {
// The error emoji randomly rotates, but then the snapshots would never match
// Have to make it consistent so the emojis are always the same
mockMathRandom(0.1);
Expand Down
2 changes: 1 addition & 1 deletion src/components/__snapshots__/AllRead.test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`components/all-read.tsx should render itself & its children 1`] = `
exports[`components/AllRead.tsx should render itself & its children 1`] = `
<div
className="flex flex-1 flex-col justify-center items-center p-4 bg-white dark:bg-gray-dark text-black dark:text-white"
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/__snapshots__/Logo.test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`components/ui/logo.tsx renders correctly (light) 1`] = `
exports[`components/Logo.tsx renders correctly (light) 1`] = `
<svg
className=""
onClick={[Function]}
Expand Down Expand Up @@ -47,7 +47,7 @@ exports[`components/ui/logo.tsx renders correctly (light) 1`] = `
</svg>
`;

exports[`components/ui/logo.tsx renders correctly(dark) 1`] = `
exports[`components/Logo.tsx renders correctly(dark) 1`] = `
<svg
className=""
onClick={[Function]}
Expand Down
2 changes: 1 addition & 1 deletion src/components/__snapshots__/NotificationRow.test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`components/Notification.js should render itself & its children 1`] = `
exports[`components/NotificationRow.tsx should render itself & its children 1`] = `
<div
className="flex space-x-3 py-2 px-3 bg-white dark:bg-gray-dark dark:text-white hover:bg-gray-100 dark:hover:bg-gray-darker border-b border-gray-100 dark:border-gray-darker group"
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/__snapshots__/Oops.test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`components/oops.tsx should render itself & its children 1`] = `
exports[`components/Oops.tsx should render itself & its children 1`] = `
<div
className="flex flex-1 flex-col justify-center items-center p-4 bg-white dark:bg-gray-dark text-black dark:text-white"
>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/LoginEnterprise.test.tsx
Expand Up @@ -16,7 +16,7 @@ jest.mock('react-router-dom', () => ({
useNavigate: () => mockNavigate,
}));

describe('routes/LoginEnterprise.js', () => {
describe('routes/LoginEnterprise.tsx', () => {
const mockAccounts: AuthState = {
enterpriseAccounts: [],
user: null,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/LoginWithToken.test.tsx
Expand Up @@ -13,7 +13,7 @@ jest.mock('react-router-dom', () => ({
useNavigate: () => mockNavigate,
}));

describe('routes/LoginWithToken.js', () => {
describe('routes/LoginWithToken.tsx', () => {
const openExternalMock = jest.spyOn(shell, 'openExternal');

const mockValidateToken = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion src/routes/Notifications.test.tsx
Expand Up @@ -17,7 +17,7 @@ jest.mock('../components/Oops', () => ({
Oops: 'Oops',
}));

describe('routes/Notifications.ts', () => {
describe('routes/Notifications.tsx', () => {
it('should render itself & its children (with notifications)', () => {
const tree = TestRenderer.create(
<AppContext.Provider
Expand Down
2 changes: 1 addition & 1 deletion src/routes/__snapshots__/LoginEnterprise.test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`routes/LoginEnterprise.js renders correctly 1`] = `
exports[`routes/LoginEnterprise.tsx renders correctly 1`] = `
<div
className="flex-1 bg-white dark:bg-gray-dark dark:text-white"
>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/__snapshots__/LoginWithToken.test.tsx.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`routes/LoginWithToken.js renders correctly 1`] = `
exports[`routes/LoginWithToken.tsx renders correctly 1`] = `
<div
className="flex-1 bg-white dark:bg-gray-dark dark:text-white"
>
Expand Down
6 changes: 3 additions & 3 deletions src/routes/__snapshots__/Notifications.test.tsx.snap
@@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`routes/Notifications.ts should render itself & its children (all read notifications) 1`] = `<AllRead />`;
exports[`routes/Notifications.tsx should render itself & its children (all read notifications) 1`] = `<AllRead />`;

exports[`routes/Notifications.ts should render itself & its children (error page - oops) 1`] = `<Oops />`;
exports[`routes/Notifications.tsx should render itself & its children (error page - oops) 1`] = `<Oops />`;

exports[`routes/Notifications.ts should render itself & its children (with notifications) 1`] = `
exports[`routes/Notifications.tsx should render itself & its children (with notifications) 1`] = `
<div
className="flex flex-col flex-1 bg-white dark:bg-gray-dark"
>
Expand Down
62 changes: 31 additions & 31 deletions src/utils/__snapshots__/github-api.test.ts.snap
@@ -1,143 +1,143 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`formatReason should format the notification reason 1`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 1`] = `
{
"description": "You were requested to review and approve a deployment.",
"type": "Approval Requested",
}
`;

exports[`formatReason should format the notification reason 2`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 2`] = `
{
"description": "You were assigned to the issue.",
"type": "Assign",
}
`;

exports[`formatReason should format the notification reason 3`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 3`] = `
{
"description": "You created the thread.",
"type": "Author",
}
`;

exports[`formatReason should format the notification reason 4`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 4`] = `
{
"description": "A GitHub Actions workflow run was triggered for your repository",
"type": "Workflow Run",
}
`;

exports[`formatReason should format the notification reason 5`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 5`] = `
{
"description": "You commented on the thread.",
"type": "Comment",
}
`;

exports[`formatReason should format the notification reason 6`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 6`] = `
{
"description": "You accepted an invitation to contribute to the repository.",
"type": "Invitation",
}
`;

exports[`formatReason should format the notification reason 7`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 7`] = `
{
"description": "You subscribed to the thread (via an issue or pull request).",
"type": "Manual",
}
`;

exports[`formatReason should format the notification reason 8`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 8`] = `
{
"description": "Organization members have requested to enable a feature such as Draft Pull Requests or CoPilot.",
"type": "Member Feature Requested",
}
`;

exports[`formatReason should format the notification reason 9`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 9`] = `
{
"description": "You were specifically @mentioned in the content.",
"type": "Mention",
}
`;

exports[`formatReason should format the notification reason 10`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 10`] = `
{
"description": "You, or a team you're a member of, were requested to review a pull request.",
"type": "Review Requested",
}
`;

exports[`formatReason should format the notification reason 11`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 11`] = `
{
"description": "You were credited for contributing to a security advisory.",
"type": "Security Advisory Credit",
}
`;

exports[`formatReason should format the notification reason 12`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 12`] = `
{
"description": "GitHub discovered a security vulnerability in your repository.",
"type": "Security Alert",
}
`;

exports[`formatReason should format the notification reason 13`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 13`] = `
{
"description": "You changed the thread state (for example, closing an issue or merging a pull request).",
"type": "State Change",
}
`;

exports[`formatReason should format the notification reason 14`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 14`] = `
{
"description": "You're watching the repository.",
"type": "Subscribed",
}
`;

exports[`formatReason should format the notification reason 15`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 15`] = `
{
"description": "You were on a team that was mentioned.",
"type": "Team Mention",
}
`;

exports[`formatReason should format the notification reason 16`] = `
exports[`utils/github-api.ts formatReason - should format the notification reason 16`] = `
{
"description": "The reason for this notification is not supported by the app.",
"type": "Unknown",
}
`;

exports[`getNotificationTypeIconColor should format the notification color for check suite 1`] = `"text-gray-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for check suite 1`] = `"text-gray-500"`;

exports[`getNotificationTypeIconColor should format the notification color for check suite 2`] = `"text-red-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for check suite 2`] = `"text-red-500"`;

exports[`getNotificationTypeIconColor should format the notification color for check suite 3`] = `"text-gray-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for check suite 3`] = `"text-gray-500"`;

exports[`getNotificationTypeIconColor should format the notification color for check suite 4`] = `"text-green-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for check suite 4`] = `"text-green-500"`;

exports[`getNotificationTypeIconColor should format the notification color for check suite 5`] = `"text-gray-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for check suite 5`] = `"text-gray-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 1`] = `"text-green-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 1`] = `"text-green-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 2`] = `"text-red-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 2`] = `"text-red-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 3`] = `"text-purple-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 3`] = `"text-purple-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 4`] = `"text-gray-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 4`] = `"text-gray-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 5`] = `"text-purple-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 5`] = `"text-purple-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 6`] = `"text-gray-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 6`] = `"text-gray-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 7`] = `"text-green-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 7`] = `"text-green-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 8`] = `"text-green-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 8`] = `"text-green-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 9`] = `"text-purple-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 9`] = `"text-purple-500"`;

exports[`getNotificationTypeIconColor should format the notification color for state 10`] = `"text-gray-500"`;
exports[`utils/github-api.ts getNotificationTypeIconColor should format the notification color for state 10`] = `"text-gray-500"`;
2 changes: 1 addition & 1 deletion src/utils/appearance.test.ts
Expand Up @@ -3,7 +3,7 @@ import { setAppearance } from './appearance';

import * as appearanceHelpers from './appearance';

describe('utils/appearance.tsx', () => {
describe('utils/appearance.ts', () => {
beforeAll(() => {
jest.spyOn(appearanceHelpers, 'setLightMode');
jest.spyOn(appearanceHelpers, 'setDarkMode');
Expand Down

0 comments on commit f8e2ebe

Please sign in to comment.