Skip to content

Instantly share code, notes, and snippets.

@jtr860830
Last active December 13, 2018 03:48
Show Gist options
  • Select an option

  • Save jtr860830/163517b2c8fd3dc8c86d679fb01b385a to your computer and use it in GitHub Desktop.

Select an option

Save jtr860830/163517b2c8fd3dc8c86d679fb01b385a to your computer and use it in GitHub Desktop.
BDD example for medium
// 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