diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts b/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts index 3be3095ca2830..723646a1763e6 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts +++ b/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts @@ -18,6 +18,7 @@ import { getCase, getCaseSavedObjectsFromES, resolveCase, + findCases, } from '../../../../common/lib/api'; import { superUser } from '../../../../common/lib/authentication/users'; @@ -73,6 +74,62 @@ export default function createGetTests({ getService }: FtrProviderContext) { syncAlerts: true, }); }); + + it('should return the cases correctly', async () => { + const cases = await findCases({ supertest }); + const theCase = cases.cases[0]; + + const { version, ...caseWithoutVersion } = theCase; + const { cases: _, ...caseStats } = cases; + + expect(cases.cases.length).to.eql(1); + + expect(caseStats).to.eql({ + count_closed_cases: 0, + count_in_progress_cases: 0, + count_open_cases: 1, + page: 1, + per_page: 20, + total: 1, + }); + + expect(caseWithoutVersion).to.eql({ + assignees: [], + category: null, + closed_at: null, + closed_by: null, + comments: [], + connector: { + fields: null, + id: 'connector-1', + name: 'none', + type: '.none', + }, + created_at: '2020-09-28T11:43:52.158Z', + created_by: { + email: null, + full_name: null, + username: 'elastic', + }, + customFields: [], + description: 'This is a brand new case of a bad meanie defacing data', + duration: null, + external_service: null, + id: 'e1900ac0-017f-11eb-93f8-d161651bf509', + owner: 'securitySolution', + settings: { + syncAlerts: true, + }, + severity: 'low', + status: 'open', + tags: ['defacement'], + title: 'Super Bad Security Issue', + totalAlerts: 0, + totalComment: 1, + updated_at: null, + updated_by: null, + }); + }); }); // tests upgrading a 7.11.1 saved object to the latest version