Created
August 19, 2012 21:43
-
-
Save bjartwolf/3397904 to your computer and use it in GitHub Desktop.
buster 301 tests
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
| buster.testCase("The ViewModel", { | |
| "setUp": function () { | |
| this.vm = new ReservationsViewModel(); | |
| }, | |
| "total sum should be zero when initialized": function () { | |
| assert.same(this.vm.totalSurcharge(), 0); | |
| }, | |
| "total number of seats should be two": function () { | |
| assert.same(this.vm.seats().length, 2); | |
| }, | |
| "after adding a seat there should be three seats": function () { | |
| this.vm.addSeat(); | |
| assert.same(this.vm.seats().length, 3); | |
| }, | |
| "after remoivng a seat there should be one seat left": function () { | |
| var seatToRemove = this.vm.seats()[0]; | |
| this.vm.removeSeat(seatToRemove); | |
| assert.same(this.vm.seats().length, 1); | |
| }, | |
| "if an attendee chooses Ultimate option total price should be 290": function () { | |
| this.vm.seats()[0].meal(this.vm.availableMeals[2]); | |
| assert.same(this.vm.totalSurcharge(), 290); | |
| }, | |
| "if both attendees choose Ultimate option total price should be twice 290": function () { | |
| var twoTimes290 = 290 * 2; | |
| this.vm.seats()[0].meal(this.vm.availableMeals[2]); | |
| this.vm.seats()[1].meal(this.vm.availableMeals[2]); | |
| assert.same(this.vm.totalSurcharge(), twoTimes290); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment