foundersandcoders / fizzbuzz

Using Test Driven Development to solve FizzBuzz - workshop written for week 2 of the Founders & Coders course
MIT License
7 stars 9 forks source link

Potential structure for the Workshop #1

Closed sohilpandya closed 7 years ago

sohilpandya commented 7 years ago

Hey @skibinska, Awesome work on the TDD Fizzbuzz challenge.

I am thinking that we can add to the three tests that you've done and follow it through to five:

QUnit.module( "FizzBuzz", function (assert) {
  QUnit.test( "when 1, returns 1", function (assert) {
    assert.equal( fizzbuzz(1), 1, "Test passed: returns 1" );
  });
  QUnit.test( "when 2, returns 2", function (assert) {
    assert.equal( fizzbuzz(2), 2, "Test passed: returns 2" );
  });
  QUnit.test( "when 3, returns Fizz", function (assert) {
    assert.equal( fizzbuzz(3), "Fizz", "Test passed: returns Fizz" );
  });
  QUnit.test( "when 4, returns Fizz", function (assert) {
    assert.equal( fizzbuzz(3), "Fizz", "Test passed: returns Fizz" );
  });
  QUnit.test( "when 5, returns Buzz", function (assert) {
    assert.equal( fizzbuzz(3), "Buzz", "Test passed: returns Buzz" );
  });
});

Make them just pass by if/else statements. then the code will be repetitive due to the if/else, so refactor it so that it returns Buzz for a 5 else returns Fizz. This will make it pass for any other number all the way to 10. (6..9 - will pass as well)

Then let them go off and solve the other part of it? (include FizzBuzz)

What are your thoughts, should we take them all the way to five tests or three tests should be ok?

skibinska commented 7 years ago

Five sounds good. :smile:

skibinska commented 7 years ago

We decided to show the students three example of code - the third one is a refactoring part, and then allow students to work in pairs.