Unverified Commit 4aace3cb authored by Jacob Kaufman's avatar Jacob Kaufman Committed by GitHub
Browse files

Merge pull request #98 from CartoCosmos/revert-97-revert-95-master

"Jupyter and App testing""
parents 983a7793 f7d42c6a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
import AstroProj from "./AstroProj";
import LayerCollection from "./LayerCollection";
// import "leaflet-fullscreen";
import L from "leaflet";
import "proj4";
import "proj4leaflet";
+1 −0
Original line number Diff line number Diff line
import { MY_JSON_MAPS } from "./layers";
import $ from "jquery";
import L from "leaflet";

+2 −3
Original line number Diff line number Diff line
import AstroMath from "./AstroMath";
import "leaflet";
import L from "leaflet";

/**
 * @class MousePositionControl
 * @aka L.Control.MousePositionControl
@@ -92,6 +90,7 @@ export default L.Control.MousePositionControl = L.Control.extend({
   */
  changeLatType(e) {
    this.isLatTypeOcentric = !this.isLatTypeOcentric;
    console.log(this.latitudeTypeOcentric);
  },

  /**
+0 −0

File moved.

+99 −0
Original line number Diff line number Diff line
import 'jsdom-global/register';
import AstroMath from '../src/js/AstroMath';
import { expect } from "chai";

describe('Testing AstroMath Functions', function() {
  let radii;
  let testMath; 
  beforeEach(function() {
    // setup math class
    radii  = {
      a: 3396190, 
      c: 3376200 
    };
    
    testMath = new AstroMath("mars",radii);
  });
 
  afterEach(function() {
    // do nothing
  })


  // testing AstroMath created a class object
  it('Testing AstroMath Object', function() {
    // add an assertion
    
    expect(testMath).to.be.an('Object');
  })

  // testing getMajorRadius function
  it('Testing getMajorRadius: Mars should be 3396190', function() {
    // add an assertion
    let majorRadius = testMath.getMajorRadius();
    expect(majorRadius).to.equal(3396190);
  })

  // testing getMinorRadius function
  it('Testing getMinorRadius: Mars should be 3376200', function() {
    // add an assertion
    let majorRadius = testMath.getMinorRadius();
    expect(majorRadius).to.equal(3376200);
  })

  // testing toRadians function
  it('Testing toRadians: 360 degrees should be 2pi', function() {
    // add an assertion
    let majorRadius = testMath.toRadians(360);
    expect(majorRadius).to.be.closeTo((2*Math.PI), 0.01);
  })

    // testing toDegrees function
    it('Testing toDegrees: 2pi degrees should be 360', function() {
      // add an assertion
      let majorRadius = testMath.toDegrees((2*Math.PI));
      expect(majorRadius).to.be.closeTo(360, 1);
    })

    // testing latToPlanetOgraphic function
    it('Testing latToPlanetOgraphic: 80 should be 80.11504513783566 ', function() {
      // add an assertion
      let majorRadius = testMath.latToPlanetOgraphic(80);
      expect(majorRadius).to.equal(80.11504513783566);
    })

    // testing lonTo360 function
    it('Testing lonTo360 Cylindrical: 0 should be 180 ', function() {
      // add an assertion
      let majorRadius = testMath.lonTo360(0, "EPSG:4326");
      expect(majorRadius).to.equal(180);
    })

    // testing lonTo360 function
    it('Testing lonTo360 Non-Cylindrical: -180 should be 0 ', function() {
      // add an assertion
      let majorRadius = testMath.lonTo360(-180, "");
      expect(majorRadius).to.equal(0);
    })

    // testing domainToPositiveWest function
    it('Testing domainToPositiveWest Normal Range: -180 should be 180 ', function() {
      // add an assertion
      let majorRadius = testMath.domainToPositiveWest(-180, true);
      expect(majorRadius).to.equal(180);
    })

    // testing domainToPositiveWest function
    it('Testing domainToPositiveWest Not Normal Range: 0 should be 360 ', function() {
      // add an assertion
      let majorRadius = testMath.domainToPositiveWest(0, false);
      expect(majorRadius).to.equal(360);
    })

    // testing wrapLongitude function
    it('Testing wrapLongitude: 360 should be 0 ', function() {
      // add an assertion
      let majorRadius = testMath.wrapLongitude(360);
      expect(majorRadius).to.equal(0);
    })
});
 No newline at end of file
Loading