-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(zimbra): tests & improve test coverage
Signed-off-by: Tristan WAGNER <[email protected]>
- Loading branch information
1 parent
a4d4d15
commit 1a078d8
Showing
67 changed files
with
1,086 additions
and
1,420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,94 @@ | ||
import { AccountType } from '@/api/account'; | ||
import { ResourceStatus } from '@/api/api.type'; | ||
|
||
export const accountMock: AccountType[] = [ | ||
{ | ||
checksum: 'string', | ||
currentState: { | ||
contactInformation: { | ||
city: 'string', | ||
company: 'string', | ||
country: 'string', | ||
faxNumber: 'string', | ||
mobileNumber: 'string', | ||
office: 'string', | ||
phoneNumber: 'string', | ||
postcode: 'string', | ||
profession: 'string', | ||
service: 'string', | ||
street: 'string', | ||
}, | ||
createdAt: '2024-07-09T13:27:12.775Z', | ||
description: 'string', | ||
detailedStatus: [ | ||
{ | ||
details: 'string', | ||
link: 'string', | ||
status: 'BLOCKEDFORSPAM', | ||
}, | ||
], | ||
displayName: 'string', | ||
domainId: '19097ad4-2870-4000-8bb0-470f414b0301', | ||
email: 'string', | ||
firstName: 'string', | ||
hideInGal: false, | ||
lastConnectionAt: '2024-07-09T13:27:12.775Z', | ||
lastName: 'string', | ||
offer: 'BUSINESS', | ||
organizationId: '19097ad4-2870-4000-82b3-b71a147bc580', | ||
organizationLabel: 'string', | ||
quota: { | ||
available: 0, | ||
used: 0, | ||
}, | ||
updatedAt: '2024-07-09T13:27:12.775Z', | ||
export const accountDetailMock: AccountType = { | ||
checksum: 'string', | ||
currentState: { | ||
contactInformation: { | ||
city: 'string', | ||
company: 'string', | ||
country: 'string', | ||
faxNumber: 'string', | ||
mobileNumber: 'string', | ||
office: 'string', | ||
phoneNumber: 'string', | ||
postcode: 'string', | ||
profession: 'string', | ||
service: 'string', | ||
street: 'string', | ||
}, | ||
currentTasks: [ | ||
createdAt: '2024-07-09T13:27:12.775Z', | ||
description: 'string', | ||
detailedStatus: [ | ||
{ | ||
id: '19097ad4-2870-4000-8bed-ecab3a061780', | ||
details: 'string', | ||
link: 'string', | ||
status: 'ERROR', | ||
type: 'string', | ||
status: 'BLOCKEDFORSPAM', | ||
}, | ||
], | ||
id: '19097ad4-2880-4000-8b03-9d110f0b8f80', | ||
resourceStatus: ResourceStatus.CREATING, | ||
targetSpec: { | ||
contactInformation: { | ||
city: 'string', | ||
company: 'string', | ||
country: 'string', | ||
faxNumber: 'string', | ||
mobileNumber: 'string', | ||
office: 'string', | ||
phoneNumber: 'string', | ||
postcode: 'string', | ||
profession: 'string', | ||
service: 'string', | ||
street: 'string', | ||
}, | ||
description: 'string', | ||
displayName: 'string', | ||
email: 'string', | ||
firstName: 'string', | ||
hideInGal: false, | ||
lastName: 'string', | ||
quota: { | ||
available: 0, | ||
used: 0, | ||
}, | ||
displayName: 'string', | ||
domainId: '19097ad4-2870-4000-8bb0-470f414b0301', | ||
email: 'string', | ||
firstName: 'string', | ||
hideInGal: false, | ||
lastConnectionAt: '2024-07-09T13:27:12.775Z', | ||
lastName: 'string', | ||
offer: 'BUSINESS', | ||
organizationId: '19097ad4-2870-4000-82b3-b71a147bc580', | ||
organizationLabel: 'string', | ||
quota: { | ||
available: 0, | ||
used: 0, | ||
}, | ||
updatedAt: '2024-07-09T13:27:12.775Z', | ||
}, | ||
currentTasks: [ | ||
{ | ||
id: '19097ad4-2870-4000-8bed-ecab3a061780', | ||
link: 'string', | ||
status: 'ERROR', | ||
type: 'string', | ||
}, | ||
], | ||
id: '19097ad4-2880-4000-8b03-9d110f0b8f80', | ||
resourceStatus: ResourceStatus.READY, | ||
targetSpec: { | ||
contactInformation: { | ||
city: 'string', | ||
company: 'string', | ||
country: 'string', | ||
faxNumber: 'string', | ||
mobileNumber: 'string', | ||
office: 'string', | ||
phoneNumber: 'string', | ||
postcode: 'string', | ||
profession: 'string', | ||
service: 'string', | ||
street: 'string', | ||
}, | ||
description: 'string', | ||
displayName: 'string', | ||
email: 'string', | ||
firstName: 'string', | ||
hideInGal: false, | ||
lastName: 'string', | ||
quota: { | ||
available: 0, | ||
used: 0, | ||
}, | ||
}, | ||
}; | ||
|
||
export const accountsMock: AccountType[] = [ | ||
accountDetailMock, | ||
{ | ||
...accountDetailMock, | ||
id: '19097ad4-2880-4444-8b03-9d110f0b8f80', | ||
resourceStatus: ResourceStatus.CREATING, | ||
}, | ||
{ | ||
...accountDetailMock, | ||
id: '19097ad4-2880-5555-8b03-9d110f0b8f80', | ||
resourceStatus: ResourceStatus.ERROR, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export const taskDetailMock = { | ||
createdAt: 'string', | ||
errors: [{ message: 'string' }], | ||
finishedAt: 'string', | ||
id: '1', | ||
link: 'string', | ||
message: 'string', | ||
progress: [{ name: 'string', status: 'string' }], | ||
startedAt: 'string', | ||
status: 'string', | ||
type: 'string', | ||
updatedAt: 'string', | ||
}; | ||
|
||
export const taskMocks = [ | ||
taskDetailMock, | ||
{ ...taskDetailMock, id: '2' }, | ||
{ ...taskDetailMock, id: '3' }, | ||
{ ...taskDetailMock, id: '4' }, | ||
{ ...taskDetailMock, id: '5' }, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/manager/apps/zimbra/src/components/Breadcrumb/__test__/Breadcrumb.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import { describe, expect } from 'vitest'; | ||
import { render } from '@/utils/test.provider'; | ||
import Breadcrumb from '../Breadcrumb'; | ||
|
||
describe('Breadcrumb component', () => { | ||
it('should render', async () => { | ||
const { getByTestId } = render(<Breadcrumb />); | ||
const cmp = getByTestId('breadcrumb'); | ||
expect(cmp).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/manager/apps/zimbra/src/components/ButtonTooltip/__test__/ButtonTooltip.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { describe, expect } from 'vitest'; | ||
import { render } from '@/utils/test.provider'; | ||
import ButtonTooltip from '../ButtonTooltip'; | ||
|
||
describe('ButtonTooltip component', () => { | ||
it('should render', async () => { | ||
const { getByTestId } = render( | ||
<ButtonTooltip tooltipContent={[{ label: 'Test' }]} />, | ||
); | ||
const cmp = getByTestId('button-tooltip'); | ||
expect(cmp).toBeInTheDocument(); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
packages/manager/apps/zimbra/src/components/Error/__test__/Error.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { describe, expect, vi } from 'vitest'; | ||
import { render } from '@/utils/test.provider'; | ||
import ErrorBanner from '../Error'; | ||
|
||
vi.mock('@ovh-ux/manager-react-core-application', async (importActual) => { | ||
return { | ||
...(await importActual< | ||
typeof import('@ovh-ux/manager-react-core-application') | ||
>()), | ||
useShell: vi.fn(() => ({ | ||
tracking: { | ||
trackPage: vi.fn(), | ||
}, | ||
environment: { | ||
getEnvironment: vi.fn(() => Promise.resolve({})), | ||
}, | ||
})), | ||
}; | ||
}); | ||
|
||
describe('Error component', () => { | ||
it('should render', async () => { | ||
const { getByText } = render( | ||
<ErrorBanner error={{ data: { message: 'test' } }} />, | ||
); | ||
expect(getByText('test')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.