Trivial: cleanup warnings in test suite (#2581)

* Mock and verify console warnings to prevent noise in the test output.

* Tighten up expectations on deprecation output.

* 80 column formatting.

* Actually fix formatting.
This commit is contained in:
Justin Morris 2017-09-15 23:42:23 +10:00 committed by Spencer Carli
parent ee2e27c24b
commit b7768d12e6
2 changed files with 12 additions and 0 deletions

View File

@ -869,6 +869,7 @@ describe('StackRouter', () => {
});
test('Maps old actions (uses "Handles the reset action" test)', () => {
global.console.warn = jest.fn();
const router = StackRouter({
Foo: {
screen: () => <div />,
@ -895,5 +896,10 @@ describe('StackRouter', () => {
expect(state2 && state2.routes[0].params).toEqual({ bar: '42' });
expect(state2 && state2.routes[0].routeName).toEqual('Foo');
expect(state2 && state2.routes[1].routeName).toEqual('Bar');
expect(console.warn).toBeCalledWith(
expect.stringContaining(
"The action type 'Init' has been renamed to 'Navigation/INIT'"
)
);
});
});

View File

@ -549,6 +549,7 @@ describe('TabRouter', () => {
});
test('Maps old actions (uses "getStateForAction returns null when navigating to same tab" test)', () => {
global.console.warn = jest.fn();
const router = TabRouter(
{ Foo: BareLeafRouteConfig, Bar: BareLeafRouteConfig },
{ initialRouteName: 'Bar' }
@ -561,6 +562,11 @@ describe('TabRouter', () => {
state
);
expect(state2).toEqual(null);
expect(console.warn).toBeCalledWith(
expect.stringContaining(
"The action type 'Init' has been renamed to 'Navigation/INIT'"
)
);
});
test('Can navigate to other tab (no router) with params', () => {