Skip to content

Commit

Permalink
added test tags
Browse files Browse the repository at this point in the history
  • Loading branch information
micax3000 committed Aug 29, 2022
1 parent ac14bb3 commit 0f7bf1b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"test:bdd": "cucumber-js --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/",
"test:unit": "nyc --all mocha --exit $(find test/unit -name '*.js')",
"test:bdd:release": "cucumber-js --tags=@release --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/",
"test:bdd:publish-errors": "cucumber-js --tags=@publish-errors --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ -r test/bdd/steps/",
"lint": "eslint ."
},
"repository": {
Expand Down
12 changes: 7 additions & 5 deletions test/bdd/features/publish-errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ Feature: Publish errors test
And 1 bootstrap is running

#TODO: needs to be investigated; publish completes even with invalid configuration
# Scenario: Node is not able to publish on a node with invalid configuration
# Given I setup publish node 1 with invalid configuration
# Given I setup 3 nodes
# When I call publish on node 1 with validAssertion
# And Last publish finished with status: PublishStartError
@publish-errors
Scenario: Node is not able to publish on a node with invalid configuration
Given I setup publish node 1 with invalid configuration
Given I setup 3 nodes
When I call publish on node 1 with validAssertion
And Last publish finished with status: PublishStartError

##
@publish-errors
Scenario: Node is not able to validate assertion on the network
Given I setup 4 nodes
When I call publish on ot-node 1 directly with invalidPublishRequestBody
Expand Down
2 changes: 1 addition & 1 deletion test/bdd/features/release.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Release related tests
Given I setup 4 nodes
When I call publish on node 1 with validAssertion
And Last publish finished with status: COMPLETED
#

@release
Scenario: Node is able to get result of the operation previously published
Given I setup 4 nodes
Expand Down
30 changes: 18 additions & 12 deletions test/bdd/steps/api/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,24 @@ When(
'Last publish data is undefined. Publish is not finalized.',
).to.be.equal(true);
// const assertionIds = [this.state.lastPublishData.result.assertion.id];
const result = await this.state.nodes[node - 1].client
.getResult(this.state.lastPublishData.UAL)
.catch((error) => {
assert.fail(`Error while trying to resolve assertion. ${error}`);
});
const { operationId } = result.operation;

this.state.lastResolveData = {
nodeId: node - 1,
operationId,
result,
};
// TODO: CALLING GET RESULT WITH WRONG UAL RETURNS UNDEFINED RESULT, IT SHOULD PROBABLY RETURN A FAILED RESULT MESSAGE OR SOMETHING LIKE THAT
try {
const result = await this.state.nodes[node - 1].client
.getResult(this.state.lastPublishData.UAL)
.catch((error) => {
assert.fail(`Error while trying to resolve assertion. ${error}`);
});
const { operationId } = result.operation;

this.state.lastResolveData = {
nodeId: node - 1,
operationId,
result,
};
} catch (e) {
this.logger.log(`Error while getting operation result: ${e}`);
}
},
);

Expand Down Expand Up @@ -77,7 +83,7 @@ Given(
'Last get result data is undefined. Get result not started.',
).to.be.equal(true);
expect(
!!this.state.lastResolveData.result,
!!this.state.lastResolveData.result.operation,
'Last get result data result is undefined. Get result is not finished.',
).to.be.equal(true);

Expand Down

0 comments on commit 0f7bf1b

Please sign in to comment.