@@ -19,32 +19,33 @@ describe('Toast', () => {
1919 expect ( props . className ) . toContain ( 'Toast--no-header' ) ;
2020 } ) ;
2121
22- describe ( 'when building alert message props' , ( ) => {
23- const setup = ( message ) => create (
22+ describe ( 'when building alert props' , ( ) => {
23+ const setup = ( props ) => create (
2424 < Toast
2525 messages = { [
26- { id : '1' , type : 'success' , message } ,
26+ { id : '1' , type : 'success' , ... props } ,
2727 ] }
2828 /> ,
2929 ) ;
3030
3131 test ( 'builds props from string message' , ( ) => {
32- const { root } = setup ( 'hello' ) ;
32+ const { root } = setup ( { message : 'hello' } ) ;
3333
3434 expect ( root . findByType ( Alert ) . props . message ) . toBe ( 'hello' ) ;
3535 } ) ;
3636
3737 test ( 'builds props from node message' , ( ) => {
38- const { root } = setup ( < div > hello</ div > ) ;
38+ const { root } = setup ( { message : < div > hello</ div > } ) ;
3939
4040 expect ( root . findByType ( Alert ) . props . message ) . toEqual ( < div > hello</ div > ) ;
4141 } ) ;
4242
43- test ( 'builds props from object message' , ( ) => {
44- const { root } = setup ( { title : 'woohoo' , body : 'you did it!' } ) ;
43+ describe ( 'when title prop is passed' , ( ) => {
44+ test ( 'builds title prop' , ( ) => {
45+ const { root } = setup ( { title : 'woohoo' , message : 'you did it!' } ) ;
4546
46- expect ( root . findByType ( Alert ) . props . message ) . toBe ( 'you did it! ' ) ;
47- expect ( root . findByType ( Alert ) . props . title ) . toBe ( 'woohoo' ) ;
47+ expect ( root . findByType ( Alert ) . props . title ) . toBe ( 'woohoo ' ) ;
48+ } ) ;
4849 } ) ;
4950 } ) ;
5051} ) ;
0 commit comments