Last active
December 13, 2018 03:48
-
-
Save jtr860830/163517b2c8fd3dc8c86d679fb01b385a to your computer and use it in GitHub Desktop.
BDD example for medium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // features/step_definitions/cal.step.js | |
| import { Given, When, Then } from "cucumber" | |
| import * as chai from "chai" | |
| chai.should() | |
| Given('the first number is {int}', function (first) { | |
| // Write code here that turns the phrase above into concrete actions | |
| this.first = first | |
| }) | |
| Given('the second number is {int}', function (second) { | |
| // Write code here that turns the phrase above into concrete actions | |
| this.second = second | |
| }) | |
| When('add two number', function () { | |
| // Write code here that turns the phrase above into concrete actions | |
| this.result = add(this.first, this.second) | |
| }) | |
| Then('result should be {int}', function (result) { | |
| // Write code here that turns the phrase above into concrete actions | |
| this.result.should.be.equal(result) | |
| }) | |
| When('the first number minus the second', function () { | |
| // Write code here that turns the phrase above into concrete actions | |
| this.result = minus(this.first, this.second) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment