You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having issues with setting a cookie, and test if the cookie is set properly.
When I set a Cookie 'foo' with the value 'bar' and I check the test if it is created succesfully by the following condition:
document.cookie.indexOf('foo=bar')
It returns 0, since the cookie will be added at the beginning of the string. I see that that is correct by the following statement:
This almost certainly has nothing to do with expect since the call to toBeGreaterThan will run synchronously. It's probably something with your mocha setup.
What likely happened is that the expectation passed, therefore making the test continue on:
it('doesnt work',function(next){expect(document.cookie.indexOf('foo=bar')).toBeGreaterThan(0)// (!) error raised, test aborted})it('works',function(next){expect(document.cookie.indexOf('foo=bar')).toBeGreaterThan(-1)// expectation passed, everything is peachy, but since no one is// calling `next()` mocha is left hanging})
I am having issues with setting a cookie, and test if the cookie is set properly.
When I set a Cookie 'foo' with the value 'bar' and I check the test if it is created succesfully by the following condition:
It returns 0, since the cookie will be added at the beginning of the string. I see that that is correct by the following statement:
This ofcourse will throw an error (Error: Expected 0 to be greater than 0). Which is ok, but whenever I try to update this test, like so:
It gives me a timeout error (Error: timeout of 2000ms exceeded). Could you please explain me, why that is?
The text was updated successfully, but these errors were encountered: