invent-ed / devleague--behavior-driven-shopping-list Goto Github PK
View Code? Open in Web Editor NEWThis project forked from devleague/behavior-driven-shopping-list
BDD Client Side Shopping List
This project forked from devleague/behavior-driven-shopping-list
BDD Client Side Shopping List
"scripts": {
"test": "echo 'run http-server or live-server then open http://localhost:8080/tests.html to run tests!'"
},
use the beforeEach()
mocha hook to create new test instances for each test
if other tests were added in the future, that mutate myList
, this test may unexpectedly fail
add more test specs when the user
is_done
to true, assert the desired output from render()
is what you expectis_done
to true, set is_done
to false, assert the desired output from render()
is what you expectexample:
tests/
js/shopping_list_test.js
js/shopping_list_item_test.js
index.html
js/
app.js ...
node_modules/
...
index.html
so that a user can go to http://localhost:8080/tests to run tests
this is a note that i want @edsperanto and @Chaz-C to be aware of
while the tests here https://github.com/edsperanto/devleague--behavior-driven-shopping-list/blob/master/js/shopping_list_item_test.js#L28-L38 will run as expected,
do note that these it()
blocks may run asynchronously (in parallel).
so while the order of these tests do not matter because of the contents of these blocks (check, and uncheck).
be aware that you should not trust that one test will happen after the other.
in order to maintain confidence when testing in isolation, utilize mocha's beforeEach()
hook, so that you can be certain that each it()
block is running using a predictable test object (myItem
).
to close this task, use beforeEach()
to instantiate a new myItem
instance each time
add more cases for when list is empty, add 1, add 1 and remove 1, add 2, add 2 then remove 1, add 1 then check() it, etc.
using dynamic values here could be problematic. what if myItem.is_done
is null
instead of the expected true
or false
values.
the render()
method would return <li class='completed_null' ...
and the tests will still pass, while this is not actually the desired behavior.
you should expect the li class to be 'completed_false'
(if it says anything except 'completed_false'
make this spec fail)
using dynamic values here could be problematic.
relates to : #15
currently checking that myList.items.length
is 0
this test would negatively pass if the class constructor looked like this
this.items = { length : 0 };
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.