Last active
June 25, 2021 00:21
-
-
Save LeilaniL/48ae4c176fad298ce5e1aa28df1b59e8 to your computer and use it in GitHub Desktop.
This file contains 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
6/24/21: never mind, here's an updated pseudocode test format example | |
Describe: .getCost() | |
// name of function the following tests are for | |
Test: It should increase the cost of a pizza by $1 for every topping chosen | |
// description of expected behavior of that function | |
Code: | |
let pizzaTest = new Pizza("large", ["pepperoni", "sausage", "mushrooms"], [], []); | |
pizzaTest.getCost(); | |
// the code you would've written in your Jest test -- usually just calling the function, but sometimes you need to instantiate an object to test on or declare some variables etc. | |
Expected Output: 18.00 | |
// what should be returned by that function | |
``` | |
Remember ARRANGE - ACT - ASSEMBLE | |
////////////////////////////////////////////////////////////////////// | |
Suggestions: | |
- In standup, let students know that the prompt's specs are meant to be a suggestion, not required and not the only way to write them (specs should look different if they're putting all functionality in one function that both generates the array and replaces things) | |
Describe: translateBeep() | |
Test: Any number containing a 1 should be changed to the word "Beep" | |
Expect(translateBeep(11)).toEqual("Beep") | |
... | |
Test: Any number containing a 3, regardless of whether it also contains a 1 or 2, should change to "Won't you be..." | |
Expect(translateBeep(321)).toEqual("Won't you be...") | |
Describe: buildArray() | |
Test: Given a number, return an array containing the count from 0 to that number | |
Expect(buildArray(5)).toEqual([0,1,2,3,4,5]) | |
////// | |
Describe: createBeepBoop() | |
Test: If the input number is 0, an array should be returned containing 0 | |
...toEqual([0]) | |
Test: If any numbers in the generated count array contain a 1, each instance should be replaced with "Beep" | |
Expect(createBeepBoop(1)).toEqual([0, "Beep"]) | |
Test: Any numbers in the generated count array containing a 3 should become "Won't you be...", regardless of also containing any 1s or 2s. | |
Expect(createBeepBoop(13)).toEqual[0,Beep,Boop,Won't you,4,5,6,7,8,9,Beep,Beep,Boop,Won't you]) | |
OR | |
Expect(createBeepBoop(13)[13]).toEqual("Won't you")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment