@@ -7,7 +7,7 @@ import { stopCreator } from './utils/stopCreator';
77import { createCanal } from '../createCanal' ;
88import { Subject } from 'rxjs' ;
99import { BackContext } from '../Navigation/BackContext' ;
10- import { IBackEvent } from '../Navigation/BackHandlerDelegate' ;
10+ import { BackEvent } from '../Navigation/BackHandlerDelegate' ;
1111
1212describe ( 'createCanal' , ( ) => {
1313 it ( 'throws an error if first arg is not a Component' , ( ) => {
@@ -41,21 +41,13 @@ describe('createCanal', () => {
4141 } ) ;
4242
4343 it ( 'renders only the first page if all authorizations are given but the one for the second page' , ( ) => {
44- const Canal = createCanal ( [
45- stopCreator ( 'a' ) ,
46- stopCreator ( 'b' ) ,
47- stopCreator ( 'c' )
48- ] ) ;
44+ const Canal = createCanal ( [ stopCreator ( 'a' ) , stopCreator ( 'b' ) , stopCreator ( 'c' ) ] ) ;
4945 const testRenderer = TestRenderer . create ( < Canal a c /> ) ;
5046 expect ( testRenderer . toJSON ( ) ) . toMatchSnapshot ( ) ;
5147 } ) ;
5248
5349 it ( 'only rerender if style was modified' , ( ) => {
54- const Canal = createCanal ( [
55- stopCreator ( 'a' ) ,
56- stopCreator ( 'b' ) ,
57- stopCreator ( 'c' )
58- ] ) ;
50+ const Canal = createCanal ( [ stopCreator ( 'a' ) , stopCreator ( 'b' ) , stopCreator ( 'c' ) ] ) ;
5951 const testRenderer = TestRenderer . create ( < Canal a /> ) ;
6052 const renderSpy = jest . spyOn (
6153 // @ts -ignore
@@ -98,9 +90,7 @@ describe('createCanal', () => {
9890 // @ts -ignore
9991 createCanal ( [ stopCreator ( 'a' ) , stopCreator ( 'a' ) ] ) ;
10092 } catch ( error ) {
101- expect ( error . message ) . toBe (
102- '`createCanal` found duplicated `name: a` key.'
103- ) ;
93+ expect ( error . message ) . toBe ( '`createCanal` found duplicated `name: a` key.' ) ;
10494 }
10595 expect . assertions ( 1 ) ;
10696 } ) ;
@@ -111,9 +101,7 @@ describe('createCanal', () => {
111101 const Canal = createCanal ( [ stopCreator ( 'a' ) , stopB ] ) ;
112102 const testRenderer = TestRenderer . create ( < Canal a /> ) ;
113103 // @ts -ignore
114- testRenderer . root . children [ 0 ] . instance . fullScreenStackProperties$ . subscribe (
115- spy
116- ) ;
104+ testRenderer . root . children [ 0 ] . instance . fullScreenStackProperties$ . subscribe ( spy ) ;
117105 // @ts -ignore
118106 const [ _ , StopB ] = testRenderer . root . children [ 0 ] . instance . stopsList ;
119107 testRenderer . update ( < Canal a /> ) ;
@@ -124,9 +112,9 @@ describe('createCanal', () => {
124112 Component : StopB . Component ,
125113 isAuthorized : false ,
126114 isFullScreen : true ,
127- name : 'b'
128- }
129- ]
115+ name : 'b' ,
116+ } ,
117+ ] ,
130118 } ) ;
131119 testRenderer . update ( < Canal a /> ) ;
132120 testRenderer . update ( < Canal a b /> ) ;
@@ -137,9 +125,9 @@ describe('createCanal', () => {
137125 Component : StopB . Component ,
138126 isAuthorized : true ,
139127 isFullScreen : true ,
140- name : 'b'
141- }
142- ]
128+ name : 'b' ,
129+ } ,
130+ ] ,
143131 } ) ;
144132 testRenderer . update ( < Canal a b /> ) ;
145133 testRenderer . update ( < Canal a b /> ) ;
@@ -151,9 +139,7 @@ describe('createCanal', () => {
151139 const Canal = createCanal ( [ stopCreator ( 'a' ) , stopCreator ( 'b' , true ) ] ) ;
152140 const testRenderer = TestRenderer . create ( < Canal a /> ) ;
153141 // @ts -ignore
154- testRenderer . root . children [ 0 ] . instance . fullScreenStackProperties$ . subscribe (
155- spy
156- ) ;
142+ testRenderer . root . children [ 0 ] . instance . fullScreenStackProperties$ . subscribe ( spy ) ;
157143 // @ts -ignore
158144 const [ _ , StopB ] = testRenderer . root . children [ 0 ] . instance . stopsList ;
159145 testRenderer . update ( < Canal a b /> ) ;
@@ -166,9 +152,9 @@ describe('createCanal', () => {
166152 Component : StopB . Component ,
167153 isAuthorized : true ,
168154 isFullScreen : true ,
169- name : 'b'
170- }
171- ]
155+ name : 'b' ,
156+ } ,
157+ ] ,
172158 } ) ;
173159 expect ( spy ) . toHaveBeenCalledWith ( {
174160 canalId : '0' ,
@@ -177,14 +163,14 @@ describe('createCanal', () => {
177163 Component : StopB . Component ,
178164 isAuthorized : false ,
179165 isFullScreen : true ,
180- name : 'b'
181- }
182- ]
166+ name : 'b' ,
167+ } ,
168+ ] ,
183169 } ) ;
184170 } ) ;
185171
186172 it ( 'passes back events on' , ( ) => {
187- const back$ = new Subject < IBackEvent > ( ) ;
173+ const back$ = new Subject < BackEvent > ( ) ;
188174 const spy = jest . fn ( ) ;
189175 const Canal = createCanal ( [ stopCreator ( 'a' ) , stopCreator ( 'b' ) ] ) ;
190176 const testRenderer = TestRenderer . create (
@@ -196,7 +182,7 @@ describe('createCanal', () => {
196182 testRenderer . root . children [ 0 ] . instance . back$ . subscribe ( spy ) ;
197183 back$ . next ( { target : null } ) ;
198184 expect ( spy ) . toHaveBeenCalledWith ( {
199- target : 'a'
185+ target : 'a' ,
200186 } ) ;
201187 testRenderer . update (
202188 < BackContext . Provider value = { { back$ } } >
@@ -205,7 +191,7 @@ describe('createCanal', () => {
205191 ) ;
206192 back$ . next ( { target : null } ) ;
207193 expect ( spy ) . toHaveBeenCalledWith ( {
208- target : 'b'
194+ target : 'b' ,
209195 } ) ;
210196 testRenderer . update (
211197 < BackContext . Provider value = { { back$ } } >
@@ -214,7 +200,7 @@ describe('createCanal', () => {
214200 ) ;
215201 back$ . next ( { target : null } ) ;
216202 expect ( spy ) . toHaveBeenCalledWith ( {
217- target : null
203+ target : null ,
218204 } ) ;
219205 } ) ;
220206} ) ;
0 commit comments