These are chat archives for CodeHubOrg/discussions

18th
Nov 2016
Katja Durrani
@katjad
Nov 18 2016 00:09
I think the styles are a bit ugly!
Dave Thomson
@rinse0ut
Nov 18 2016 01:23
Where are the tests!? :disappointed_relieved:
Katja Durrani
@katjad
Nov 18 2016 01:28
in which branch? I haven't disappeared any tests..
Dave Thomson
@rinse0ut
Nov 18 2016 07:43
I can’t see any tests for the new components. Perhaps next session we should write them?
Katja Durrani
@katjad
Nov 18 2016 07:47
ahh I think I might have written only one 🤔 I was naughty
Katja Durrani
@katjad
Nov 18 2016 07:54
yes would be good writing them next time
Dave Thomson
@rinse0ut
Nov 18 2016 08:41
You’re not the only naughty one! I think we may have to introduce the naughty step to JS101.
Tim Handy
@TimHandy
Nov 18 2016 09:44
Yes, I would like to shoulder-surf some tests being written, attempted to learn the fundamentals yesterday... but keep getting lost in dependency injections and async. Going to go again today, and see if I can get it into my noggin.
Dave Thomson
@rinse0ut
Nov 18 2016 09:52
Try writing a simple test for a function that adds two numbers
Specify what you expect the result should be and then check to see if it equals the acutal result
returned from the function
Tim Handy
@TimHandy
Nov 18 2016 11:16
yeah, basic tests like that I understand
going to see if i can implement them in one of my basic projects and see what happens
Dave Thomson
@rinse0ut
Nov 18 2016 11:40
Try BDD
Write a test
Watch it fail
Make the test pass in a basic way
Then refactor the code
Are you doing vanilla js or React?
One great aspect of BDD is that it helps you write better code. Single Responsibility Principle, Dependency Injection etc
Think of the different edge cases you can test for eg -1, 0, 1 etc
Or you could start writing a test a component in the JS101 App