diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-02-26 11:27:31 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-02-26 11:27:31 +0100 |
commit | 62b3afeeedfe054345f86093e2d243e956c1e3c9 (patch) | |
tree | bbd58f5c8c07f5d87b1c1cca73fa1d5af6178f48 /src/web/js/stores/__tests__ | |
parent | Updated Python dependencies. (diff) | |
download | newspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.tar.gz newspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.tar.bz2 newspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.zip |
The project is now using Poetry.
Diffstat (limited to 'src/web/js/stores/__tests__')
-rw-r--r-- | src/web/js/stores/__tests__/TodoStore-test.js | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/web/js/stores/__tests__/TodoStore-test.js b/src/web/js/stores/__tests__/TodoStore-test.js deleted file mode 100644 index 6da6cd3c..00000000 --- a/src/web/js/stores/__tests__/TodoStore-test.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * TodoStore-test - */ - -jest.dontMock('../../constants/TodoConstants'); -jest.dontMock('../TodoStore'); -jest.dontMock('object-assign'); - -describe('TodoStore', function() { - - var TodoConstants = require('../../constants/TodoConstants'); - var AppDispatcher; - var TodoStore; - var callback; - - // mock actions - var actionTodoCreate = { - actionType: TodoConstants.TODO_CREATE, - text: 'foo' - }; - var actionTodoDestroy = { - actionType: TodoConstants.TODO_DESTROY, - id: 'replace me in test' - }; - - beforeEach(function() { - AppDispatcher = require('../../dispatcher/AppDispatcher'); - TodoStore = require('../TodoStore'); - callback = AppDispatcher.register.mock.calls[0][0]; - }); - - it('registers a callback with the dispatcher', function() { - expect(AppDispatcher.register.mock.calls.length).toBe(1); - }); - - it('should initialize with no to-do items', function() { - var all = TodoStore.getAll(); - expect(all).toEqual({}); - }); - - it('creates a to-do item', function() { - callback(actionTodoCreate); - var all = TodoStore.getAll(); - var keys = Object.keys(all); - expect(keys.length).toBe(1); - expect(all[keys[0]].text).toEqual('foo'); - }); - - it('destroys a to-do item', function() { - callback(actionTodoCreate); - var all = TodoStore.getAll(); - var keys = Object.keys(all); - expect(keys.length).toBe(1); - actionTodoDestroy.id = keys[0]; - callback(actionTodoDestroy); - expect(all[keys[0]]).toBeUndefined(); - }); - - it('can determine whether all to-do items are complete', function() { - var i = 0; - for (; i < 3; i++) { - callback(actionTodoCreate); - } - expect(Object.keys(TodoStore.getAll()).length).toBe(3); - expect(TodoStore.areAllComplete()).toBe(false); - - var all = TodoStore.getAll(); - for (key in all) { - callback({ - actionType: TodoConstants.TODO_COMPLETE, - id: key - }); - } - expect(TodoStore.areAllComplete()).toBe(true); - - callback({ - actionType: TodoConstants.TODO_UNDO_COMPLETE, - id: key - }); - expect(TodoStore.areAllComplete()).toBe(false); - }); - -}); |