@@ -3,13 +3,11 @@ import React from 'react';
33import {
44 renderApollo ,
55 cleanup ,
6- getByTestId ,
76 fireEvent ,
87 waitForElement ,
9- render ,
108} from '../../test-utils' ;
11- import BookTrips , { BOOK_TRIPS , GET_LAUNCH } from '../book-trips' ;
12- import { GET_CART_ITEMS } from '../../pages/ cart' ;
9+ import BookTrips , { BOOK_TRIPS } from '../book-trips' ;
10+ import { GET_LAUNCH } from '../cart-item ' ;
1311
1412const mockLaunch = {
1513 __typename : 'Launch' ,
@@ -37,7 +35,7 @@ describe('book trips', () => {
3735 it ( 'completes mutation and shows message' , async ( ) => {
3836 let mocks = [
3937 {
40- request : { query : BOOK_TRIPS , variables : { launchIds : [ 1 ] } } ,
38+ request : { query : BOOK_TRIPS , variables : { launchIds : [ '1' ] } } ,
4139 result : {
4240 data : {
4341 bookTrips : [ { success : true , message : 'success!' , launches : [ ] } ] ,
@@ -46,12 +44,12 @@ describe('book trips', () => {
4644 } ,
4745 {
4846 // we need this query for refetchQueries
49- request : { query : GET_LAUNCH , variables : { launchId : 1 } } ,
47+ request : { query : GET_LAUNCH , variables : { launchId : '1' } } ,
5048 result : { data : { launch : mockLaunch } } ,
5149 } ,
5250 ] ;
53- const { getByText , container , getByTestId } = renderApollo (
54- < BookTrips cartItems = { [ 1 ] } /> ,
51+ const { getByTestId } = renderApollo (
52+ < BookTrips cartItems = { [ '1' ] } /> ,
5553 { mocks, addTypename : false } ,
5654 ) ;
5755
@@ -61,7 +59,7 @@ describe('book trips', () => {
6159 // the component re-renders.
6260 // getByTestId throws an error if it cannot find an element with the given ID
6361 // and waitForElement will wait until the callback doesn't throw an error
64- const successText = await waitForElement ( ( ) => getByTestId ( 'message' ) ) ;
62+ await waitForElement ( ( ) => getByTestId ( 'message' ) ) ;
6563 } ) ;
6664
6765 // >>>> TODO
0 commit comments