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
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
We have recently migrated to angular 1.4, and we noticed some tests are intermittently failing due to state that is being leftover between tests in the cookies. It appears the the mocking of cookies was removed from angular-mocks in the latest versions. I have a couple of plunks to illustrate the point.
@Narretz In previous versions of Angular, $browser.cookies() was completely mocked out by ngMock and writing a cookie through $cookies wrote to an in-memory map and not the browser. We've discussed this in the past and considered adding a test-kit that hooks into new cookies mechanism and gives tools that verify that cookies are written with correct params (it is no longer just about cookie value), but I don't think this is very critical.
@butchpeters I think the best way to go is for you to mock $cookies in your test:
Does the Angular team believe that no one needs to test setting and getting cookies with ngCookies? I'm shocked to discover that a year after the release of 1.4 this still hasn't been dealt with.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We have recently migrated to angular 1.4, and we noticed some tests are intermittently failing due to state that is being leftover between tests in the cookies. It appears the the mocking of cookies was removed from angular-mocks in the latest versions. I have a couple of plunks to illustrate the point.
Here, in angular 1.3, the cookie is set in $cookieStore in one test, and it is not defined in $cookieStore in subsequent tests:
http://plnkr.co/edit/WbRKACxBvJkHUmJwntN4?p=preview
In angular 1.4, however, the cookie is still set on subsequent tests, causing it to fail:
http://plnkr.co/edit/c6jpOmmSuufSYvQysdTQ?p=preview
Was this functionality intentionally removed, and if so can you let me know what the intended workaround is?
The text was updated successfully, but these errors were encountered: