In my React application there is a map which is being loaded using esri loader. Below is the code for loading map with the help of esri-loader using React.
App.js
import React, { useEffect } from "react";
import { loadModules } from "esri-loader";
import "./App.css";
export default function App() {
let mapView;
useEffect(()=>{
//load the api modules
loadModules(
[
'esri/Map',
'esri/views/MapView',
'esri/widgets/ScaleBar',
'esri/widgets/Home',
"esri/layers/FeatureLayer",
], { css:true })
.then(([Map, MapView, ScaleBar, Home, FeatureLayer])=>{
let featureLayer = new FeatureLayer({
url:
"https://services.arcgis.com/xdbDcZrQnv51VAwh/arcgis/rest/services/US_City_Population/FeatureServer"
});
let map = new Map({
basemap: "topo-vector",
ground: "world-elevation",
layers: [featureLayer]
});
mapView = new MapView({
map: map,
container: "viewDiv"
})
})
return(
<div className='App'>
<div className='mainDiv>
<div id='viewDiv'>
</div>
</div>
</div>
)
I want to create a unit test file which will test if the map has been loaded or not. I am very new to unit testing in React. There hasn't been much which was put to use here. Would really appreciate any suggestions?