Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Jun 9, 2021
1 parent f895bb1 commit 2785118
Showing 1 changed file with 12 additions and 24 deletions.
36 changes: 12 additions & 24 deletions x-pack/test/api_integration/apis/ml/jobs/datafeed_preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,10 @@ export default ({ getService }: FtrProviderContext) => {
.send({ job, datafeed })
.expect(200);

expect(body.hits.total.value).to.eql(3207, 'Response body total hits should be 3207');
expect(Array.isArray(body.hits?.hits[0]?.fields?.airline)).to.eql(
true,
'Response body airlines should be an array'
);
expect(body.length).to.eql(1000, 'Response body total hits should be 1000');
expect(typeof body[0]?.airline).to.eql('string', 'Response body airlines should be a string');

const airlines: string[] = body.hits.hits.map((a: any) => a.fields.airline[0]);
const airlines: string[] = body.map((a: any) => a.airline);
expect(airlines.length).to.not.eql(0, 'airlines length should not be 0');
expect(airlines.every((a) => isUpperCase(a))).to.eql(
true,
Expand Down Expand Up @@ -112,13 +109,10 @@ export default ({ getService }: FtrProviderContext) => {
.send({ job, datafeed })
.expect(200);

expect(body.hits.total.value).to.eql(300, 'Response body total hits should be 300');
expect(Array.isArray(body.hits?.hits[0]?.fields?.airline)).to.eql(
true,
'Response body airlines should be an array'
);
expect(body.length).to.eql(1000, 'Response body total hits should be 1000');
expect(typeof body[0]?.airline).to.eql('string', 'Response body airlines should be a string');

const airlines: string[] = body.hits.hits.map((a: any) => a.fields.airline[0]);
const airlines: string[] = body.map((a: any) => a.airline);
expect(airlines.length).to.not.eql(0, 'airlines length should not be 0');
expect(airlines.every((a) => a === 'AAL')).to.eql(
true,
Expand Down Expand Up @@ -157,13 +151,10 @@ export default ({ getService }: FtrProviderContext) => {
.send({ job, datafeed })
.expect(200);

expect(body.hits.total.value).to.eql(3207, 'Response body total hits should be 3207');
expect(Array.isArray(body.hits?.hits[0]?.fields?.lowercase_airline)).to.eql(
true,
'Response body airlines should be an array'
);
expect(body.length).to.eql(1000, 'Response body total hits should be 1000');
expect(typeof body[0]?.airline).to.eql('string', 'Response body airlines should be a string');

const airlines: string[] = body.hits.hits.map((a: any) => a.fields.lowercase_airline[0]);
const airlines: string[] = body.map((a: any) => a.lowercase_airline);
expect(airlines.length).to.not.eql(0, 'airlines length should not be 0');
expect(isLowerCase(airlines[0])).to.eql(
true,
Expand Down Expand Up @@ -205,13 +196,10 @@ export default ({ getService }: FtrProviderContext) => {
.send({ job, datafeed })
.expect(200);

expect(body.hits.total.value).to.eql(300, 'Response body total hits should be 300');
expect(Array.isArray(body.hits?.hits[0]?.fields?.airline)).to.eql(
true,
'Response body airlines should be an array'
);
expect(body.length).to.eql(1000, 'Response body total hits should be 1000');
expect(typeof body[0]?.airline).to.eql('string', 'Response body airlines should be a string');

const airlines: string[] = body.hits.hits.map((a: any) => a.fields.airline[0]);
const airlines: string[] = body.map((a: any) => a.airline);
expect(airlines.length).to.not.eql(0, 'airlines length should not be 0');
expect(isLowerCase(airlines[0])).to.eql(
true,
Expand Down

0 comments on commit 2785118

Please sign in to comment.