Skip to content

Commit

Permalink
updating test checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Feb 7, 2022
1 parent 145a8c6 commit 5bece64
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,26 @@ export default ({ getService }: FtrProviderContext) => {
idSpace1
);

expect(resp).to.eql(
expectedCategoryDefinition,
`response should be ${JSON.stringify(expectedCategoryDefinition)} (got ${JSON.stringify(
resp
)})`
expect(resp.categoryId).to.eql(
expectedCategoryDefinition.categoryId,
`categoryId should be ${expectedCategoryDefinition.categoryId} (got ${resp.categoryId})`
);
expect(resp.examples.length).to.eql(
expectedCategoryDefinition.examples.length,
`examples list length should be ${expectedCategoryDefinition.examples.length} (got ${resp.examples.length})`
);
expect(resp.terms.length).to.be.greaterThan(
0,
`terms string length should be greater than 0 (got ${resp.terms.length})`
);
});

it('should not produce the correct category for the job', async () => {
const resp = await getCategoryDefinition(jobIdSpace1, '2', USER.ML_POWERUSER, 200, idSpace1);

expect(resp).to.not.eql(
expectedCategoryDefinition,
`response should not be ${JSON.stringify(expectedCategoryDefinition)} (got ${JSON.stringify(
resp
)})`
expect(resp.categoryId).to.not.eql(
expectedCategoryDefinition.categoryId,
`categoryId should not be ${expectedCategoryDefinition.categoryId} (got ${resp.categoryId})`
);
});

Expand All @@ -153,11 +157,17 @@ export default ({ getService }: FtrProviderContext) => {
idSpace1
);

expect(resp).to.eql(
expectedCategoryDefinition,
`response should be ${JSON.stringify(expectedCategoryDefinition)} (got ${JSON.stringify(
resp
)})`
expect(resp.categoryId).to.eql(
expectedCategoryDefinition.categoryId,
`categoryId should be ${expectedCategoryDefinition.categoryId} (got ${resp.categoryId})`
);
expect(resp.examples.length).to.eql(
expectedCategoryDefinition.examples.length,
`examples list length should be ${expectedCategoryDefinition.examples.length} (got ${resp.examples.length})`
);
expect(resp.terms.length).to.be.greaterThan(
0,
`terms string length should be greater than 0 (got ${resp.terms.length})`
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,9 @@ export default ({ getService }: FtrProviderContext) => {
idSpace1
);

expect(resp).to.eql(
expectedCategoryExamples1,
`response should be ${JSON.stringify(expectedCategoryExamples1)} (got ${JSON.stringify(
resp
)})`
expect(resp['1'].length).to.eql(
expectedCategoryExamples1['1'].length,
`response examples length should be ${expectedCategoryExamples1['1'].length} (got ${resp['1'].length})`
);
});

Expand All @@ -135,11 +133,9 @@ export default ({ getService }: FtrProviderContext) => {
idSpace1
);

expect(resp).to.eql(
expectedCategoryExamples3,
`response should be ${JSON.stringify(expectedCategoryExamples3)} (got ${JSON.stringify(
resp
)})`
expect(resp['1'].length).to.eql(
expectedCategoryExamples3['1'].length,
`response examples length should be ${expectedCategoryExamples3['1'].length} (got ${resp['1'].length})`
);
});

Expand All @@ -153,11 +149,11 @@ export default ({ getService }: FtrProviderContext) => {
idSpace1
);

expect(resp).to.not.eql(
expectedCategoryExamples3,
`response should not be ${JSON.stringify(expectedCategoryExamples3)} (got ${JSON.stringify(
resp
)})`
expect(Object.keys(resp)).to.not.eql(
Object.keys(expectedCategoryExamples3),
`response examples keys should be ${Object.keys(
expectedCategoryExamples3
)} (got ${Object.keys(resp)})`
);
});

Expand All @@ -182,11 +178,9 @@ export default ({ getService }: FtrProviderContext) => {
idSpace1
);

expect(resp).to.eql(
expectedCategoryExamples3,
`response should be ${JSON.stringify(expectedCategoryExamples3)} (got ${JSON.stringify(
resp
)})`
expect(resp['1'].length).to.eql(
expectedCategoryExamples3['1'].length,
`response examples length should be ${expectedCategoryExamples3['1'].length} (got ${resp['1'].length})`
);
});

Expand Down

0 comments on commit 5bece64

Please sign in to comment.