Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-buttner committed Apr 11, 2023
1 parent 97bed79 commit 31801a7
Show file tree
Hide file tree
Showing 2 changed files with 254 additions and 5 deletions.
92 changes: 91 additions & 1 deletion x-pack/plugins/cases/server/telemetry/queries/cases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,62 @@ describe('getCasesTelemetryData', () => {
const filesRes: FileAttachmentAggregationResults = {
securitySolution: {
averageSize: 500,
topMimeTypes: {
buckets: [
{
doc_count: 5,
key: 'image/png',
},
{
doc_count: 1,
key: 'application/json',
},
],
},
},
observability: {
averageSize: 500,
topMimeTypes: {
buckets: [
{
doc_count: 5,
key: 'image/png',
},
{
doc_count: 1,
key: 'application/json',
},
],
},
},
cases: {
averageSize: 500,
topMimeTypes: {
buckets: [
{
doc_count: 5,
key: 'image/png',
},
{
doc_count: 1,
key: 'application/json',
},
],
},
},
averageSize: 500,
topMimeTypes: {
buckets: [
{
doc_count: 5,
key: 'image/png',
},
{
doc_count: 1,
key: 'application/json',
},
],
},
};

mockFind(caseAggsResult);
Expand Down Expand Up @@ -259,6 +307,16 @@ describe('getCasesTelemetryData', () => {
average,
maxOnACase: 10,
total,
topMimeTypes: [
{
count: 5,
name: 'image/png',
},
{
count: 1,
name: 'application/json',
},
],
},
},
};
Expand Down Expand Up @@ -644,6 +702,7 @@ describe('getCasesTelemetryData', () => {
},
"terms": Object {
"field": "cases-comments.attributes.externalReferenceAttachmentTypeId",
"size": 10,
},
},
"persistableReferenceTypes": Object {
Expand Down Expand Up @@ -677,6 +736,7 @@ describe('getCasesTelemetryData', () => {
},
"terms": Object {
"field": "cases-comments.attributes.persistableStateAttachmentTypeId",
"size": 10,
},
},
},
Expand Down Expand Up @@ -717,6 +777,7 @@ describe('getCasesTelemetryData', () => {
},
"terms": Object {
"field": "cases-comments.attributes.externalReferenceAttachmentTypeId",
"size": 10,
},
},
"observability": Object {
Expand Down Expand Up @@ -752,6 +813,7 @@ describe('getCasesTelemetryData', () => {
},
"terms": Object {
"field": "cases-comments.attributes.externalReferenceAttachmentTypeId",
"size": 10,
},
},
"persistableReferenceTypes": Object {
Expand Down Expand Up @@ -785,6 +847,7 @@ describe('getCasesTelemetryData', () => {
},
"terms": Object {
"field": "cases-comments.attributes.persistableStateAttachmentTypeId",
"size": 10,
},
},
},
Expand Down Expand Up @@ -830,6 +893,7 @@ describe('getCasesTelemetryData', () => {
},
"terms": Object {
"field": "cases-comments.attributes.persistableStateAttachmentTypeId",
"size": 10,
},
},
"securitySolution": Object {
Expand Down Expand Up @@ -865,6 +929,7 @@ describe('getCasesTelemetryData', () => {
},
"terms": Object {
"field": "cases-comments.attributes.externalReferenceAttachmentTypeId",
"size": 10,
},
},
"persistableReferenceTypes": Object {
Expand Down Expand Up @@ -898,6 +963,7 @@ describe('getCasesTelemetryData', () => {
},
"terms": Object {
"field": "cases-comments.attributes.persistableStateAttachmentTypeId",
"size": 10,
},
},
},
Expand Down Expand Up @@ -1031,6 +1097,12 @@ describe('getCasesTelemetryData', () => {
"field": "file.attributes.size",
},
},
"topMimeTypes": Object {
"terms": Object {
"field": "file.attributes.mime_type",
"size": 20,
},
},
},
"filter": Object {
"term": Object {
Expand All @@ -1045,6 +1117,12 @@ describe('getCasesTelemetryData', () => {
"field": "file.attributes.size",
},
},
"topMimeTypes": Object {
"terms": Object {
"field": "file.attributes.mime_type",
"size": 20,
},
},
},
"filter": Object {
"term": Object {
Expand All @@ -1059,20 +1137,32 @@ describe('getCasesTelemetryData', () => {
"field": "file.attributes.size",
},
},
"topMimeTypes": Object {
"terms": Object {
"field": "file.attributes.mime_type",
"size": 20,
},
},
},
"filter": Object {
"term": Object {
"file.attributes.Meta.owner": "securitySolution",
},
},
},
"topMimeTypes": Object {
"terms": Object {
"field": "file.attributes.mime_type",
"size": 20,
},
},
},
"filter": Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "file.attributes.Meta.caseId",
"value": "file.attributes.Meta.caseIds",
},
Object {
"type": "wildcard",
Expand Down
Loading

0 comments on commit 31801a7

Please sign in to comment.