Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

components over time display name instead of id #2855

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update tests
  • Loading branch information
JerrySentry committed May 7, 2024
commit 681f0d76bf61eb50e3b1e24c0a066087e95ee68f
Original file line number Diff line number Diff line change
@@ -43,13 +43,15 @@ const mockedComponentMeasurements = {
__typename: 'Repository',
components: [
{
componentId: 'components1_id',
name: 'components1',
percentCovered: 93.26,
percentChange: -1.56,
lastUploaded: '2021-09-30T00:00:00Z',
measurements: [{ avg: 51.78 }, { avg: 93.356 }],
},
{
componentId: 'components2_id',
name: 'component2',
percentCovered: 91.74,
percentChange: null,
@@ -58,6 +60,7 @@ const mockedComponentMeasurements = {
},

{
componentId: 'testtest_id',
name: 'testtest',
percentCovered: 1.0,
percentChange: 1.0,
@@ -76,6 +79,7 @@ const mockNoReportsUploadedMeasurements = {
components: [
{
name: 'components1',
componentId: 'components1_id',
percentCovered: null,
percentChange: null,
lastUploaded: null,
Original file line number Diff line number Diff line change
@@ -60,6 +60,7 @@ describe('DeleteComponentModal', () => {
render(
<DeleteComponentModal
componentId="component-123"
name="componentName"
closeModal={jest.fn()}
isOpen
/>,
@@ -74,14 +75,15 @@ describe('DeleteComponentModal', () => {
)
expect(messagePartTwo).toBeInTheDocument()

const componentId = await screen.findAllByText(/component-123/)
const componentId = await screen.findAllByText(/componentName/)
expect(componentId).toHaveLength(3)
})

it('renders delete and cancel buttons', async () => {
render(
<DeleteComponentModal
componentId="component-123"
name="componentName"
closeModal={jest.fn()}
isOpen
/>,
@@ -101,14 +103,15 @@ describe('DeleteComponentModal', () => {
render(
<DeleteComponentModal
componentId="component-123"
name="componentName"
closeModal={jest.fn()}
isOpen
/>,
{
wrapper,
}
)
const title = await screen.findByTestId(/remove-component-123/)
const title = await screen.findByTestId(/remove-componentName/)
expect(title).toBeInTheDocument()
})
})
@@ -120,6 +123,7 @@ describe('DeleteComponentModal', () => {
render(
<DeleteComponentModal
componentId="component-123"
name="componentName"
closeModal={closeModal}
isOpen
/>,
@@ -143,6 +147,7 @@ describe('DeleteComponentModal', () => {
render(
<DeleteComponentModal
componentId="component-123"
name="componentName"
closeModal={closeModal}
isOpen
/>,
Original file line number Diff line number Diff line change
@@ -82,13 +82,15 @@ const mockedComponentMeasurements = {
components: [
{
name: 'component1',
componentId: 'component1Id',
percentCovered: 93.26,
percentChange: 1.65,
lastUploaded: null,
measurements: [],
},
{
name: 'component2',
componentId: 'component2Id',
percentCovered: 91.74,
percentChange: 2.65,
lastUploaded: null,
@@ -111,13 +113,15 @@ const mockEmptyComponentMeasurements = {
const componentsData = [
{
name: 'component1',
componentId: 'component1Id',
percentCovered: 93.26,
percentChange: 1.65,
measurements: [],
lastUploaded: null,
},
{
name: 'component2',
componentId: 'component2Id',
percentCovered: 91.74,
percentChange: 2.65,
measurements: [],
2 changes: 2 additions & 0 deletions src/services/repo/useRepoComponents.spec.tsx
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ afterAll(() => server.close())
const expectedData = [
{
name: 'component1',
componentId: 'component1Id',
percentCovered: 93.26,
percentChange: 1.65,
lastUploaded: '2021-09-30T00:00:00Z',
@@ -45,6 +46,7 @@ const expectedData = [
},
{
name: 'component2',
componentId: 'component2Id',
percentCovered: 92.72,
percentChange: 1.58,
lastUploaded: null,
Loading
Oops, something went wrong.