Skip to content

Commit

Permalink
[Cases] Add migration test for the Find Cases API (elastic#168444)
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas authored Oct 10, 2023
1 parent 99f20d9 commit 3d979ad
Showing 1 changed file with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
getCase,
getCaseSavedObjectsFromES,
resolveCase,
findCases,
} from '../../../../common/lib/api';
import { superUser } from '../../../../common/lib/authentication/users';

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3d979ad

Please sign in to comment.