Open theRemix opened 7 years ago
fixed this issue by adding new test that checks if myList.items is an array, because it should not be an object
same issue here https://github.com/edsperanto/devleague--behavior-driven-shopping-list/blob/master/tests/shopping_list_test.js#L26
the test has the chance of negatively passing in this case
this.items = {
length : 0,
push : function(){}
};
@theRemix I don't understand what "negatively passing" means? do you mean its not supposed to pass when its constructed like this, or it SHOULD pass even if it's constructed like this?
negatively passing => undesired behavior/implemention still passes the tests
If i were to alter ShoppingList to initialize the .items
property as
this.items = {
length : 0,
push : function(){}
};
would mean that this code will pass while it clearly is not the desired implementation.
can you think of a better way to test what datatype the .items
property should be?
currently checking that
myList.items.length
is 0this test would negatively pass if the class constructor looked like this
https://github.com/edsperanto/devleague--behavior-driven-shopping-list/blob/master/js/shopping_list_item_test.js#L60-L64