test: Move mock json blobs to fixtures
This moves all mock json blobs from the Mock Service Worker handlers and component tests into one central location under `/fixtures`.
This commit is contained in:
parent
313c0f60b6
commit
8f021105b4
11 changed files with 983 additions and 970 deletions
|
|
@ -3,7 +3,7 @@ import { act, screen, waitFor } from '@testing-library/react';
|
|||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import api from '../../../api.js';
|
||||
import { RHEL_8 } from '../../../constants.js';
|
||||
import { mockState } from '../../fixtures/composes.js';
|
||||
import { renderWithReduxRouter } from '../../testUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
|
|
@ -14,150 +14,6 @@ jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
|||
}),
|
||||
}));
|
||||
|
||||
const mockComposes = {
|
||||
count: 1,
|
||||
allIds: ['1579d95b-8f1d-4982-8c53-8c2afa4ab04c'],
|
||||
byId: {
|
||||
'1579d95b-8f1d-4982-8c53-8c2afa4ab04c': {
|
||||
id: '1579d95b-8f1d-4982-8c53-8c2afa4abc',
|
||||
image_name: 'testImageName',
|
||||
created_at: '2021-04-27 12:31:12.794809 +0000 UTC',
|
||||
request: {
|
||||
distribution: RHEL_8,
|
||||
image_requests: [
|
||||
{
|
||||
architecture: 'x86_64',
|
||||
image_type: 'aws',
|
||||
upload_request: {
|
||||
type: 'aws',
|
||||
options: {
|
||||
share_with_accounts: ['123123123123'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
clones: [
|
||||
'f9133ec4-7a9e-4fd9-9a9f-9636b82b0a5d',
|
||||
'48fce414-0cc0-4a16-8645-e3f0edec3212',
|
||||
'0169538e-515c-477e-b934-f12783939313',
|
||||
'4a851db1-919f-43ca-a7ef-dd209877a77e',
|
||||
],
|
||||
image_status: {
|
||||
status: 'success',
|
||||
upload_status: {
|
||||
options: {
|
||||
ami: 'ami-0217b81d9be50e44b',
|
||||
region: 'us-east-1',
|
||||
},
|
||||
status: 'success',
|
||||
type: 'aws',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
error: null,
|
||||
};
|
||||
|
||||
const mockClones = {
|
||||
allIds: [
|
||||
'f9133ec4-7a9e-4fd9-9a9f-9636b82b0a5d',
|
||||
'48fce414-0cc0-4a16-8645-e3f0edec3212',
|
||||
'0169538e-515c-477e-b934-f12783939313',
|
||||
'4a851db1-919f-43ca-a7ef-dd209877a77e',
|
||||
],
|
||||
byId: {
|
||||
'f9133ec4-7a9e-4fd9-9a9f-9636b82b0a5d': {
|
||||
created_at: '2021-04-27 12:31:12.794809 +0000 UTC',
|
||||
id: 'f9133ec4-7a9e-4fd9-9a9f-9636b82b0a5d',
|
||||
request: {
|
||||
region: 'us-west-1',
|
||||
share_with_accounts: ['123123123123'],
|
||||
},
|
||||
parent: '1579d95b-8f1d-4982-8c53-8c2afa4ab04c',
|
||||
image_status: {
|
||||
status: 'success',
|
||||
upload_status: {
|
||||
options: {
|
||||
ami: 'ami-0e778053cd490ad21',
|
||||
region: 'us-west-1',
|
||||
},
|
||||
status: 'success',
|
||||
type: 'aws',
|
||||
},
|
||||
},
|
||||
},
|
||||
// Duplicate us-west-1 clone with different ami created one day later
|
||||
'48fce414-0cc0-4a16-8645-e3f0edec3212': {
|
||||
created_at: '2021-04-28 12:31:12.794809 +0000 UTC',
|
||||
id: '48fce414-0cc0-4a16-8645-e3f0edec3212',
|
||||
request: {
|
||||
region: 'us-west-1',
|
||||
share_with_accounts: ['123123123123'],
|
||||
},
|
||||
parent: '1579d95b-8f1d-4982-8c53-8c2afa4ab04c',
|
||||
image_status: {
|
||||
status: 'success',
|
||||
upload_status: {
|
||||
options: {
|
||||
ami: 'ami-9f0asd1tlk2142124',
|
||||
region: 'us-west-1',
|
||||
},
|
||||
status: 'success',
|
||||
type: 'aws',
|
||||
},
|
||||
},
|
||||
},
|
||||
'0169538e-515c-477e-b934-f12783939313': {
|
||||
created_at: '2021-04-27 12:31:12.794809 +0000 UTC',
|
||||
id: '0169538e-515c-477e-b934-f12783939313',
|
||||
request: {
|
||||
region: 'us-west-2',
|
||||
share_with_accounts: ['123123123123'],
|
||||
},
|
||||
parent: '1579d95b-8f1d-4982-8c53-8c2afa4ab04c',
|
||||
image_status: {
|
||||
status: 'failure',
|
||||
upload_status: {
|
||||
options: {
|
||||
ami: 'ami-9fdskj12fdsak1211',
|
||||
region: 'us-west-2',
|
||||
},
|
||||
status: 'failure',
|
||||
type: 'aws',
|
||||
},
|
||||
},
|
||||
},
|
||||
'4a851db1-919f-43ca-a7ef-dd209877a77e': {
|
||||
created_at: '2021-04-27 12:31:12.794809 +0000 UTC',
|
||||
id: '4a851db1-919f-43ca-a7ef-dd209877a77e',
|
||||
request: {
|
||||
region: 'eu-central-1',
|
||||
share_with_accounts: ['000000000000'],
|
||||
},
|
||||
parent: '1579d95b-8f1d-4982-8c53-8c2afa4ab04c',
|
||||
image_status: {
|
||||
status: 'success',
|
||||
upload_status: {
|
||||
options: {
|
||||
ami: 'ami-9fdskj12fdsak1211',
|
||||
region: 'eu-central-1',
|
||||
},
|
||||
status: 'success',
|
||||
type: 'aws',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
error: null,
|
||||
};
|
||||
|
||||
const mockState = {
|
||||
clones: { ...mockClones },
|
||||
composes: { ...mockComposes },
|
||||
notifications: [],
|
||||
};
|
||||
|
||||
const composeId = '1579d95b-8f1d-4982-8c53-8c2afa4ab04c';
|
||||
|
||||
describe('Create Share To Regions Modal', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue