diff --git a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.test.tsx b/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.test.tsx index 7b9d6d87b2..c8486d3d70 100644 --- a/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.test.tsx +++ b/plugins/github-issues/src/components/GitHubIssues/GitHubIssues.test.tsx @@ -20,12 +20,48 @@ import { catalogApiRef, CatalogApi, } from '@backstage/plugin-catalog-react'; +import { faker } from '@faker-js/faker'; +import { Entity } from '@backstage/catalog-model'; -import { generateTestIssue } from '../../utils'; -import { GitHubIssuesApi, gitHubIssuesApiRef } from '../../api'; +import { GitHubIssuesApi, gitHubIssuesApiRef, Issue } from '../../api'; import { GitHubIssues } from './GitHubIssues'; -import { Entity } from '@backstage/catalog-model'; + +const generateTestIssue = ( + overwrites: Partial = {}, +): { node: Issue } => ({ + node: { + ...{ + assignees: { + edges: [ + { + node: { + avatarUrl: faker.internet.avatar(), + login: `${faker.word.adjective()}-${faker.animal.type()}`, + }, + }, + ], + }, + author: { + login: `${faker.word.adjective()}-${faker.animal.type()}`, + }, + repository: { + nameWithOwner: `${faker.animal.type()}/${faker.animal.type()}`, + }, + title: faker.lorem.words(3), + url: faker.internet.url(), + participants: { + totalCount: +faker.random.numeric(), + }, + updatedAt: faker.date.past().toISOString(), + createdAt: faker.date.past().toISOString(), + comments: { + totalCount: +faker.random.numeric(), + }, + }, + ...overwrites, + }, +}); jest .useFakeTimers() diff --git a/plugins/github-issues/src/utils/generateTestIssue.ts b/plugins/github-issues/src/utils/generateTestIssue.ts deleted file mode 100644 index a07c8dfc57..0000000000 --- a/plugins/github-issues/src/utils/generateTestIssue.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { faker } from '@faker-js/faker'; -import { Issue } from '../api'; - -export const generateTestIssue = ( - overwrites: Partial = {}, -): { node: Issue } => ({ - node: { - ...{ - assignees: { - edges: [ - { - node: { - avatarUrl: faker.internet.avatar(), - login: `${faker.word.adjective()}-${faker.animal.type()}`, - }, - }, - ], - }, - author: { - login: `${faker.word.adjective()}-${faker.animal.type()}`, - }, - repository: { - nameWithOwner: `${faker.animal.type()}/${faker.animal.type()}`, - }, - title: faker.lorem.words(3), - url: faker.internet.url(), - participants: { - totalCount: +faker.random.numeric(), - }, - updatedAt: faker.date.past().toISOString(), - createdAt: faker.date.past().toISOString(), - comments: { - totalCount: +faker.random.numeric(), - }, - }, - ...overwrites, - }, -}); diff --git a/plugins/github-issues/src/utils/index.ts b/plugins/github-issues/src/utils/index.ts deleted file mode 100644 index 16740dac94..0000000000 --- a/plugins/github-issues/src/utils/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export * from './generateTestIssue';