FAIL src/test/home.test.js Home component ✕ DidMount (108ms) ✕ play zone content (2ms) ✕ card content (1ms) ✕ BookNow Click (1ms) ✕ On Clicking Book Now (1ms) ● Home component › DidMount TypeError: Cannot read property 'contextTypes' of undefined 36 | { id: 3, src: FootBall, name: "FootBall", slots: bookSlot4 } 37 | ] > 38 | component = shallow( | ^ 39 | { > 50 | expect(mockfn1).toHaveBeenCalledTimes(1); | ^ 51 | expect(mockfn2).toHaveBeenCalledTimes(1); 52 | }) 53 | it("play zone content", () => { at Object.it (src/test/home.test.js:50:21) ● Home component › play zone content TypeError: Cannot read property 'contextTypes' of undefined 36 | { id: 3, src: FootBall, name: "FootBall", slots: bookSlot4 } 37 | ] > 38 | component = shallow( | ^ 39 | { > 54 | expect(component.find("header").length).toBe(1); | ^ 55 | expect(component.find("header").text()).toEqual("Play Zone "); 56 | expect(component.find(".Card").length).toBe(4); 57 | const align = component at Object.it (src/test/home.test.js:54:22) ● Home component › card content TypeError: Cannot read property 'contextTypes' of undefined 36 | { id: 3, src: FootBall, name: "FootBall", slots: bookSlot4 } 37 | ] > 38 | component = shallow( | ^ 39 | { > 66 | const Cards = component.find(".Card"); | ^ 67 | const Product = Cards.find("ul").map(child => child.text()); 68 | expect(Product).toEqual([ 69 | "BasketBallBook Now", at Object.it (src/test/home.test.js:66:29) ● Home component › BookNow Click TypeError: Cannot read property 'contextTypes' of undefined 36 | { id: 3, src: FootBall, name: "FootBall", slots: bookSlot4 } 37 | ] > 38 | component = shallow( | ^ 39 | { > 76 | const spy = jest.spyOn(component.instance(), "handlebook"); | ^ 77 | const BookNow_Btn = component 78 | .find("center") 79 | .at(0) at Object.it (src/test/home.test.js:76:38) ● Home component › On Clicking Book Now TypeError: Cannot read property 'contextTypes' of undefined 36 | { id: 3, src: FootBall, name: "FootBall", slots: bookSlot4 } 37 | ] > 38 | component = shallow( | ^ 39 | { > 88 | const spy = jest.spyOn(component.instance(), "handleSearch"); | ^ 89 | const check_btn = component 90 | .find("center") 91 | .at(1) at Object.it (src/test/home.test.js:88:38) console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:50. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:50. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:50. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:50. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:143. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:50. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:50. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:214. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:50. console.error node_modules/react/cjs/react.development.js:315 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check your code at book.test.js:250. FAIL src/test/book.test.js Book page ✕ Book Content (81ms) ✕ input fields (1ms) ✕ err msg: select your slot (1ms) ✕ err msg check your field (2ms) ✕ Display slot (1ms) ✕ Booking not opened (1ms) ✕ Booking Closed (2ms) ● Book page › Book Content TypeError: Cannot read property 'contextTypes' of undefined 47 | ) 48 | const slotBooked1 = undefined > 49 | component = shallow( | ^ 50 | 67 | expect(component.find("header").length).toBe(1); | ^ 68 | expect(component.find("header").childAt(0).length).toBe(1); 69 | expect(component.find("header").find("p").length).toBe(1); 70 | expect(component.find("header").text()).toBe( at Object.it (src/test/book.test.js:67:22) ● Book page › input fields TypeError: Cannot read property 'contextTypes' of undefined 47 | ) 48 | const slotBooked1 = undefined > 49 | component = shallow( | ^ 50 | { > 83 | expect(component.find("#contact").length).toBe(2); | ^ 84 | component 85 | .find("#contact") 86 | .at(0) at Object.it (src/test/book.test.js:83:22) ● Book page › err msg: select your slot TypeError: Cannot read property 'contextTypes' of undefined 47 | ) 48 | const slotBooked1 = undefined > 49 | component = shallow( | ^ 50 | { > 106 | component.find("#book_button").simulate("Click"); | ^ 107 | expect(component.state().errorStmt).toEqual("Select your slot!!!"); 108 | component 109 | .find("#contact") at Object.it (src/test/book.test.js:106:15) ● Book page › err msg check your field TypeError: Cannot read property 'contextTypes' of undefined 47 | ) 48 | const slotBooked1 = undefined > 49 | component = shallow( | ^ 50 | 142 | const wrapper = shallow( | ^ 143 | 49 | component = shallow( | ^ 50 | { > 195 | expect(component.find("Connect(Slots)").length).toBe(1); | ^ 196 | }); 197 | it("Booking not opened", () => { 198 | const Games3 = [ at Object.it (src/test/book.test.js:195:22) ● Book page › Booking not opened TypeError: Cannot read property 'contextTypes' of undefined 47 | ) 48 | const slotBooked1 = undefined > 49 | component = shallow( | ^ 50 | 213 | const wrapper = shallow( | ^ 214 | 49 | component = shallow( | ^ 50 | 249 | const wrapper = shallow( | ^ 250 | child.text()); > 64 | expect(Product).toEqual([ | ^ 65 | "09.00 A.M - 10.00 A.M", 66 | "10.00 A.M - 11.00 A.M", 67 | "11.00 A.M - 12.00 P.M", at Object.it (src/test/slot.test.js:64:21) ● Slot component › handle_Slot Method “simulate” is meant to be run on 1 node. 0 found instead. 81 | .find("span") 82 | .at(3); > 83 | slot.simulate("click"); | ^ 84 | expect(spy).toBeCalledTimes(1); 85 | }); 86 | }); at ShallowWrapper.single (node_modules/enzyme/src/ShallowWrapper.js:1652:13) at ShallowWrapper.simulate (node_modules/enzyme/src/ShallowWrapper.js:1133:17) at Object.it (src/test/slot.test.js:83:10) FAIL src/test/reducer.test.js testing cart reducer ✕ initial state check (7ms) ✕ UPDATE_BOOKING (4ms) ✕ select game(onBook) (6ms) ✕ onShow (1ms) ✕ on select slot (5ms) ✕ DONE_BOOKING (1ms) ✕ doneBooking (1ms) ✕ check Booking (2ms) ● testing cart reducer › initial state check expect(received).toEqual(expected) // deep equality - Expected + Received Object { - "Games": Array [], + "Games": Array [ + "Cricket", + "Football", + "Tennis", + ], "bookingCheck": Array [], "details": Array [], - "selectedDate": 2025-05-28T00:00:00.000Z, + "selectedDate": "2025-05-28", "selectedGame": Array [], "slotBooked": undefined, } 19 | }; 20 | it("initial state check", () => { > 21 | expect(bookNowReducer(undefined, {})).toEqual(initState); | ^ 22 | }); 23 | it("UPDATE_BOOKING", () => { 24 | const state = { at Object.it (src/test/reducer.test.js:21:43) ● testing cart reducer › UPDATE_BOOKING expect(received).toEqual(expected) // deep equality - Expected + Received Object { - "Games": Array [ - Object { - "id": 0, - "name": "BasketBall", - "slots": Array [ - Object { - "endTime": "10.00 A.M", - "id": 1, - "slotStatus": "btn btn-success", - "startTime": "09.00 A.M", - }, - Object { - "endTime": "11.00 A.M", - "id": 2, - "slotStatus": "btn btn-success", - "startTime": "10.00 A.M", - }, - Object { - "endTime": "12.00 P.M", - "id": 3, - "slotStatus": "btn btn-success", - "startTime": "11.00 A.M", - }, - Object { - "endTime": "01.00 P.M", - "id": 4, - "slotStatus": "btn btn-success", - "startTime": "12.00 P.M", - }, - Object { - "endTime": "02.00 P.M", - "id": 5, - "slotStatus": "btn btn-success", - "startTime": "01.00 P.M", - }, - Object { - "endTime": "03.00 P.M", - "id": 6, - "slotStatus": "btn btn-success", - "startTime": "02.00 P.M", - }, - Object { - "endTime": "04.00 P.M", - "id": 7, - "slotStatus": "btn btn-success", - "startTime": "03.00 P.M", - }, - Object { - "endTime": "05.00 P.M", - "id": 8, - "slotStatus": "btn btn-success", - "startTime": "04.00 P.M", - }, - Object { - "endTime": "06.00 P.M", - "id": 9, - "slotStatus": "btn btn-success", - "startTime": "05.00 P.M", - }, - ], - "src": "basket_ball.jpeg", - }, - Object { - "id": 1, - "name": "VolleyBall", - "slots": Array [ - Object { - "endTime": "10.00 A.M", - "id": 1, - "slotStatus": "btn btn-success", - "startTime": "09.00 A.M", - }, - Object { - "endTime": "11.00 A.M", - "id": 2, - "slotStatus": "btn btn-success", - "startTime": "10.00 A.M", - }, - Object { - "endTime": "12.00 P.M", - "id": 3, - "slotStatus": "btn btn-success", - "startTime": "11.00 A.M", - }, - Object { - "endTime": "01.00 P.M", - "id": 4, - "slotStatus": "btn btn-success", - "startTime": "12.00 P.M", - }, - Object { - "endTime": "02.00 P.M", - "id": 5, - "slotStatus": "btn btn-success", - "startTime": "01.00 P.M", - }, - Object { - "endTime": "03.00 P.M", - "id": 6, - "slotStatus": "btn btn-success", - "startTime": "02.00 P.M", - }, - Object { - "endTime": "04.00 P.M", - "id": 7, - "slotStatus": "btn btn-success", - "startTime": "03.00 P.M", - }, - Object { - "endTime": "05.00 P.M", - "id": 8, - "slotStatus": "btn btn-success", - "startTime": "04.00 P.M", - }, - Object { - "endTime": "06.00 P.M", - "id": 9, - "slotStatus": "btn btn-success", - "startTime": "05.00 P.M", - }, - ], - "src": "volleyBall.jpeg", - }, - ], - "details": Array [ - Object { - "bookingId": "14440074", - "contact": "9876443111", - "game": "BasketBall", - "name": "Roger", - "slot": Object { - "endTime": "01.00 P.M", - "id": 4, - "slotStatus": "btn btn-success", - "startTime": "12.00 P.M", - }, - "slotDate": "6/12/2020", - }, - Object { - "bookingId": "92303869", - "contact": "9867844311", - "game": "FootBall", - "name": "shelly", - "slot": Object { - "endTime": "12.00 P.M", - "id": 3, - "slotStatus": "btn btn-success", - "startTime": "11.00 A.M", - }, - "slotDate": "6/12/2020", - }, - ], + "Games": Array [], + "details": Array [], } 42 | } 43 | ] > 44 | })).toEqual({ | ^ 45 | Games: [ 46 | { id: 0, src: BasketBall, name: "BasketBall", slots: bookSlot1 }, 47 | { id: 1, src: VolleyBall, name: "VolleyBall", slots: bookSlot2 } at Object.it (src/test/reducer.test.js:44:9) ● testing cart reducer › select game(onBook) expect(received).toEqual(expected) // deep equality - Expected + Received @@ -121,67 +121,9 @@ }, ], "src": "volleyBall.jpeg", }, ], - "selectedGame": Object { - "id": 1, - "name": "VolleyBall", - "slots": Array [ - Object { - "endTime": "10.00 A.M", - "id": 1, - "slotStatus": "btn btn-success", - "startTime": "09.00 A.M", - }, - Object { - "endTime": "11.00 A.M", - "id": 2, - "slotStatus": "btn btn-success", - "startTime": "10.00 A.M", - }, - Object { - "endTime": "12.00 P.M", - "id": 3, - "slotStatus": "btn btn-success", - "startTime": "11.00 A.M", - }, - Object { - "endTime": "01.00 P.M", - "id": 4, - "slotStatus": "btn btn-success", - "startTime": "12.00 P.M", - }, - Object { - "endTime": "02.00 P.M", - "id": 5, - "slotStatus": "btn btn-success", - "startTime": "01.00 P.M", - }, - Object { - "endTime": "03.00 P.M", - "id": 6, - "slotStatus": "btn btn-success", - "startTime": "02.00 P.M", - }, - Object { - "endTime": "04.00 P.M", - "id": 7, - "slotStatus": "btn btn-success", - "startTime": "03.00 P.M", - }, - Object { - "endTime": "05.00 P.M", - "id": 8, - "slotStatus": "btn btn-success", - "startTime": "04.00 P.M", - }, - Object { - "endTime": "06.00 P.M", - "id": 9, - "slotStatus": "btn btn-success", - "startTime": "05.00 P.M", - }, + "selectedGame": Array [ + undefined, ], - "src": "volleyBall.jpeg", - }, } 67 | selectedGame: [] 68 | }; > 69 | expect(bookNowReducer(state, { type: "SELECT_GAME", id: 1 })).toEqual({ | ^ 70 | Games: [ 71 | { id: 0, src: BasketBall, name: "BasketBall", slots: bookSlot1 }, 72 | { id: 1, src: VolleyBall, name: "VolleyBall", slots: bookSlot2 } at Object.it (src/test/reducer.test.js:69:67) ● testing cart reducer › onShow expect(received).toEqual(expected) // deep equality - Expected + Received Object { - "selectedDate": "Wed Mar 11 2020 12:00:00 GMT+0530 (India Standard Time)", + "selectedDate": 2025-05-28T00:00:00.000Z, } 124 | Day: "Wed Mar 11 2020 12:00:00 GMT+0530 (India Standard Time)" 125 | }) > 126 | ).toEqual({ | ^ 127 | selectedDate: "Wed Mar 11 2020 12:00:00 GMT+0530 (India Standard Time)" 128 | }); 129 | }); at Object.it (src/test/reducer.test.js:126:7) ● testing cart reducer › on select slot expect(received).toEqual(expected) // deep equality - Expected + Received @@ -58,12 +58,7 @@ "startTime": "05.00 P.M", }, ], "src": "volleyBall.jpeg", }, - "slotBooked": Object { - "endTime": "11.00 A.M", - "id": 2, - "slotStatus": "btn btn-primary", - "startTime": "10.00 A.M", - }, + "slotBooked": undefined, } 133 | slotBooked: undefined 134 | }; > 135 | expect(bookNowReducer(state, { type: "ON_SELECT_SLOT", id: 2 })).toEqual({ | ^ 136 | selectedGame: { id: 1, src: VolleyBall, name: "VolleyBall", slots: bookSlot2 }, 137 | slotBooked: { id: 2, startTime: "10.00 A.M", endTime: "11.00 A.M", slotStatus: "btn btn-primary" } 138 | }); at Object.it (src/test/reducer.test.js:135:70) ● testing cart reducer › DONE_BOOKING expect(received).toEqual(expected) // deep equality - Expected + Received @@ -10,13 +10,18 @@ "startTime": "09.00 A.M", }, Object { "endTime": "11.00 A.M", "id": 2, - "slotStatus": "btn btn-danger", + "slotStatus": "btn btn-primary", "startTime": "10.00 A.M", }, ], "src": "volleyBall.jpeg", }, - "slotBooked": undefined, + "slotBooked": Object { + "endTime": "11.00 A.M", + "id": 2, + "slotStatus": "btn btn-primary", + "startTime": "10.00 A.M", + }, } 177 | slotBooked: { id: 2, startTime: "10.00 A.M", endTime: "11.00 A.M", slotStatus: "btn btn-primary" } 178 | }; > 179 | expect(bookNowReducer(state, { type: "DONE_BOOKING" })).toEqual({ | ^ 180 | selectedGame: { 181 | id: 1, src: VolleyBall, name: "VolleyBall", 182 | slots: [ at Object.it (src/test/reducer.test.js:179:61) ● testing cart reducer › doneBooking expect(received).toEqual(expected) // deep equality - Expected + Received Object { - "slotBooked": undefined, + "slotBooked": Object { + "endTime": "11.00 A.M", + "id": 2, + "slotStatus": "btn btn-primary", + "startTime": "10.00 A.M", + }, } 193 | slotBooked: { id: 2, startTime: "10.00 A.M", endTime: "11.00 A.M", slotStatus: "btn btn-primary" } 194 | }; > 195 | expect(bookNowReducer(state, { type: "ICON_CLICK", id: 2 })).toEqual({ | ^ 196 | slotBooked: undefined 197 | }) 198 | }) at Object.it (src/test/reducer.test.js:195:66) ● testing cart reducer › check Booking expect(received).toEqual(expected) // deep equality - Expected + Received @@ -1,21 +1,7 @@ Object { - "bookingCheck": Array [ - Object { - "bookingId": "92303869", - "contact": "9867844311", - "game": "FootBall", - "name": "shelly", - "slot": Object { - "endTime": "12.00 P.M", - "id": 3, - "slotStatus": "btn btn-success", - "startTime": "11.00 A.M", - }, - "slotDate": "6/12/2020", - }, - ], + "bookingCheck": Array [], "details": Array [ Object { "bookingId": "14440074", "contact": "9876443111", "game": "BasketBall", 219 | expect( 220 | bookNowReducer(state, { type: "CHECK_BOOKING", payload: "9230" }) > 221 | ).toEqual({ | ^ 222 | bookingCheck: [ 223 | { 224 | bookingId: "92303869", at Object.it (src/test/reducer.test.js:221:7) Test Suites: 5 failed, 5 total Tests: 29 failed, 29 total Snapshots: 0 total Time: 5.281s Ran all test suites. npm ERR! Test failed. See above for more details. user@c067045535d2:/projects/challenge$