Skip to content

Commit

Permalink
fix(bruno): refactor tests to comply with expected TAXII responses
Browse files Browse the repository at this point in the history
- ' Get API Root Information' had a test that was expecting a property in camelCase. This was refactored to expect the property in snake_case.
- 'Get Object Versions' had a test that was expecting the 'more' property to be required. This was refactored to be optional.
  • Loading branch information
seansica committed Nov 17, 2024
1 parent 9647725 commit 4a53be8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions bruno/Get API Root Information.bru
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ tests {
const data = res.getBody();
expect(data).to.have.property('title').that.is.a('string').and.is.not.empty;
expect(data).to.have.property('description').that.is.a('string').and.is.not.empty;
expect(data).to.have.property('version').that.is.a('string').and.startsWith('application/taxii+json');
expect(data).to.have.property('maxContentLength');
const maxContentLength = data.maxContentLength;
expect(data).to.have.property('versions').that.is.an('array');
data.versions.forEach(version => {
expect(version).startsWith('application/taxii+json');
});
expect(data).to.have.property('max_content_length');
const maxContentLength = data['max_content_length'];

if (typeof maxContentLength === 'string') {
expect(parseInt(maxContentLength)).to.be.a('number').and.not.NaN;
Expand Down
4 changes: 3 additions & 1 deletion bruno/Get Object Versions.bru
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ tests {

test("Verify response body structure", function() {
const data = res.getBody();
expect(data).to.have.property('more').that.is.a('boolean');
if (data.hasOwnProperty('more')) {
expect(data.more).to.be.a('boolean');
}

// The list of object versions returned by the request.
if (data.hasOwnProperty('versions')) {
Expand Down

0 comments on commit 4a53be8

Please sign in to comment.