Skip to content

Commit 50b0b08

Browse files
This test is unnecessary
It was initially created to confirm "removeCookie" was returning "false" in the case it couldn't be able to remove the cookie. But the only thing it is doing is to stub the API and force returning false, there is no real value on this test. If you change the boolean return of "removeCookie", 2 tests fail anyway, "removeCookie: when cookie does not exist" and "removeCookie: when sucessfully deleted". All evidences points out this test is really unnecessary and non-deterministic. Also, this test relies in internal behavior for stubbing, future code changes might require the modification of an unrelated test, which is not ideal.
1 parent 8b6ebc4 commit 50b0b08

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

test/tests.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -288,26 +288,6 @@ test('when cookie does not exist', function () {
288288
strictEqual(Cookies.remove('c'), true, 'returns true');
289289
});
290290

291-
// The following test relies on internals, any change here might not be deterministic in the future.
292-
// Rewrite it later.
293-
294-
//test('when deletion failed', function () {
295-
// expect(1);
296-
// $.cookie('c', 'v');
297-
//
298-
// var originalCookie = $.cookie;
299-
// $.cookie = function () {
300-
// // Stub deletion...
301-
// if (arguments.length === 1) {
302-
// return originalCookie.apply(null, arguments);
303-
// }
304-
// };
305-
//
306-
// strictEqual($.removeCookie('c'), false, 'returns false');
307-
//
308-
// $.cookie = originalCookie;
309-
//});
310-
311291
test('with options', function () {
312292
expect(1);
313293
var options = { path: '/' };

0 commit comments

Comments
 (0)