You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature: Getting rich writing softwareScenario: Depositing a paycheckGiven my account balance is $10
When I get paid $1000000 for writing some awesome code
Then my account balance should be $1000010
import{defineFeature,loadFeature}from'jest-cucumber';importBankAccountfrom'../BankAccount';constfeature=loadFeature('./features/GettingRichWritingSoftware.feature');defineFeature(feature,test=>{letmyAccount;beforeEach(()=>{myAccount=newBankAccount();});test('Depositing a paycheck',({ given, when, then })=>{given(/^my account balance is \$(\d+)$/,accountBalance=>{myAccount.deposit(parseInt(accountBalance));});when(/^I get paid \$(\d+) for writing awesome code$/,amount=>{myAccount.deposit(parseInt(amount));});then(/^my account balance should be \$(\d+)$/,accountBalance=>{expect(myAccount.balance).toBe(parseInt(accountBalance));});});});