Commit 799d15f2 authored by Jacob Kaufman's avatar Jacob Kaufman
Browse files

Added Mouse Position Unit test

parent 97782817
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
import AstroProj from "./AstroProj";
import LayerCollection from "./LayerCollection";
import "leaflet-fullscreen";
import L from "leaflet";
/**
 * @class AstroMap
 * @aka L.Map.AstroMap
+1 −0
Original line number Diff line number Diff line
import { MY_JSON_MAPS } from "./layers";
import L from "leaflet";
import $ from "jquery";

/**
+1 −1
Original line number Diff line number Diff line
import AstroMath from "./AstroMath";
import "leaflet";
import L from "Leaflet";
/**
 * @class MousePosition
 * @aka L.Control.AstroMousePosition
+10 −0
Original line number Diff line number Diff line
@@ -7,6 +7,16 @@ let testMath = new AstroMath("mars");

describe('Testing AstroMath Functions', function() {

  beforeEach(function() {
    // setup math class
    let testMath = new AstroMath("mars");
  });
 
  afterEach(function() {
    // do nothing
  })


  // testing AstroMath created a class object
  it('Testing AstroMath Object', function() {
    // add an assertion
+29 −0
Original line number Diff line number Diff line
import "jsdom-global/register";
import jsdom from "mocha-jsdom";
import AstroMap from "../src/js/AstroMap";
import MousePosition from "../src/js/MousePosition";
import { assert, expect } from "chai";

 beforeEach(function() {
   // Setup map div
   document.body.innerHTML = '<div id="map"></div>';
 });

 afterEach(function() {
   // Setup map div
   document.body.innerHTML = "";
 });
 /*
 In order for test to run correctly you must comment out html and event code from _add function in MousePosition.
 */
 describe("MousePosition Added to AstroMap", function() {
   it("testMousePosition._map returns the map object if attached with no errors", function() {
     let target = "Mars";
     let testMap = new AstroMap("map", target, {});
     let testMousePosition = new MousePosition({
         numDigits: 3
      }).addTo(testMap);
     
     expect(testMousePosition._map).to.be.an("Object");
   });
 });
 No newline at end of file