Unverified Commit 2177bb83 authored by cgm78's avatar cgm78 Committed by GitHub
Browse files

Merge pull request #79 from jkaufy/master

Fixed Python Directories and Added testing to App
parents 43f5fd38 9bd1c5e7
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
{
  "presets": ["airbnb"],
  "presets": [
    "airbnb",
    [
      "@babel/preset-env",
      {
        "modules": false
      }
    ]
  ],
  "plugins": [
    [
      "babel-plugin-import",
+8 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
    "start": "webpack-dev-server --open --config webpack.dev.js",
    "build": "webpack --config webpack.prod.js",
    "lint": "eslint --ext .js src",
    "test": "mocha --require @babel/register",
    "fix": "npm run lint -- --fix",
    "prettier-watch": "onchange '**/*.js' -- prettier --write {{changed}}",
    "generate-docs": "node_modules/.bin/jsdoc src/js/  --configure .jsdoc.json --verbose"
@@ -40,11 +41,13 @@
    "@babel/core": "^7.8.3",
    "@babel/preset-env": "^7.8.3",
    "@babel/preset-react": "^7.8.3",
    "@babel/register": "7.9.0",
    "@babel/runtime": "^7.8.3",
    "autoprefixer": "^9.7.4",
    "babel-loader": "^8.0.6",
    "babel-plugin-import": "^1.13.0",
    "babel-preset-airbnb": "^4.4.0",
    "babel-root-slash-import": "^1.1.0",
    "better-docs": "^1.4.7",
    "braintree-jsdoc-template": "^3.3.0",
    "clean-webpack-plugin": "^3.0.0",
@@ -57,6 +60,11 @@
    "html-loader": "^0.5.5",
    "html-webpack-plugin": "^3.2.0",
    "jsdoc": "^3.6.3",
    "jsdom": "^16.2.1",
    "jsdom-global": "3.0.2",
    "mocha": "^7.1.1",
    "mocha-jsdom": "^2.0.0",
    "chai": "^4.2.0",
    "onchange": "^6.1.0",
    "precss": "^4.0.0",
    "prettier": "^1.19.1",
+15 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ export default class AstroMath {
   * @return {double} The converted value in radians.
   */
  toRadians(degrees) {
    return (degrees * Math.PI) / 180;
    return degrees * (Math.PI / 180);
  }
  /**
   * @function AstroMath.prototype.toDegrees
@@ -103,9 +103,22 @@ export default class AstroMath {
    if (projection === "EPSG:4326") {
      convertedLon -= 180;
    }
    

    if (convertedLon < 0) {
      if (projection == "EPSG:4326")
      {
        convertedLon += 360;
      }
      else
      {
        convertedLon += 180;
      }
    }
    else if (projection != "EPSG:4326")
    {
      convertedLon += 180;
    }

    return convertedLon;
  }
+26 −19
Original line number Diff line number Diff line
@@ -119,7 +119,8 @@ export default L.Control.MousePosition = L.Control.extend({
    let { lng } = e.latlng;
    let { lat } = e.latlng;

    lat = L.Util.wrapNum(lat, [-90.0, 90.0]);
    if (lat <= 90 && lat >= -90)
    {
      lng = L.Util.wrapNum(lng, [-180.0, 180.0]);

      if (!this.isLatTypeOcentric) {
@@ -144,6 +145,12 @@ export default L.Control.MousePosition = L.Control.extend({
      //const prefixAndValue = `${this.options.prefix}${value}`;
      this.lonDisplayElement.innerHTML = lng;
      this.latDisplayElement.innerHTML = lat;
    }
    else
    {
      this.lonDisplayElement.innerHTML = "---.---";
      this.latDisplayElement.innerHTML = "---.---";
    }
  },
  /**
   * @function MousePosition.prototype.onMouseOut
+86 −0
Original line number Diff line number Diff line
import 'jsdom-global/register';
import AstroMath from '../src/js/AstroMath';
import { expect } from "chai";

// global class AstroMath variable
let testMath = new AstroMath("mars");

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

  // 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