mirror of
https://github.com/status-im/react-native.git
synced 2025-01-19 14:02:10 +00:00
21ee7fde6e
Summary:Fixes mocking in NavigationExperimental tests and manually mock React to make things pass Closes https://github.com/facebook/react-native/pull/6124 Differential Revision: D2970955 fb-gh-sync-id: ece45f1193a23a39d49fb9c2f529e1d709189f31 shipit-source-id: ece45f1193a23a39d49fb9c2f529e1d709189f31
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, 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.
|
|
*
|
|
* @flow-broken
|
|
*/
|
|
'use strict';
|
|
|
|
jest
|
|
.dontMock('NavigationFindReducer');
|
|
|
|
const NavigationFindReducer = require('NavigationFindReducer');
|
|
|
|
describe('NavigationFindReducer', () => {
|
|
|
|
it('handles basic find reducing with strings', () => {
|
|
let reducer = NavigationFindReducer([
|
|
s => s,
|
|
s => s + '_yes',
|
|
s => 'nope',
|
|
]);
|
|
let route = reducer('input');
|
|
expect(route).toBe('input_yes');
|
|
|
|
reducer = NavigationFindReducer([
|
|
(s, action) => s,
|
|
(s, action) => 'origRoute',
|
|
(s, action) => 'firstChangedState',
|
|
]);
|
|
route = reducer('origRoute', 'action1');
|
|
expect(route).toBe('firstChangedState');
|
|
|
|
reducer = NavigationFindReducer([
|
|
(s, action) => s,
|
|
(s, action) => action,
|
|
]);
|
|
route = reducer('inputState', 'action2');
|
|
expect(route).toBe('action2');
|
|
});
|
|
|
|
});
|