lapentafd | 360b7a3 | 2022-03-08 09:25:43 +0000 | [diff] [blame^] | 1 | /*- |
| 2 | * ============LICENSE_START======================================================= |
| 3 | * ONAP CLAMP |
| 4 | * ================================================================================ |
| 5 | * Copyright (C) 2022 Nordix Foundation. All rights reserved. |
| 6 | * ================================================================================ |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | * ============LICENSE_END============================================ |
| 19 | * =================================================================== |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | import React from "react"; |
| 24 | import ReactDOM from "react-dom"; |
| 25 | import { Route, MemoryRouter } from 'react-router-dom' |
| 26 | import OnapClamp from './OnapClamp'; |
| 27 | |
| 28 | |
| 29 | |
| 30 | const routing = ( |
| 31 | <MemoryRouter forceRefresh={ false }> |
| 32 | <Route path="/" component={ OnapClamp }/> |
| 33 | </MemoryRouter> |
| 34 | ); |
| 35 | jest.mock("react-dom", () => ({ render: jest.fn() })); |
| 36 | |
| 37 | describe("Application root", () => { |
| 38 | it("should render without crashing", () => { |
| 39 | const div = document.createElement("div"); |
| 40 | div.id = "root"; |
| 41 | document.body.appendChild(div); |
| 42 | require("./index.js"); |
| 43 | expect(ReactDOM.render).toHaveBeenCalledWith(routing, div); |
| 44 | }); |
| 45 | }); |