Commit 7a340cf0 authored by Jacob Kaufman's avatar Jacob Kaufman
Browse files

Deleting files for PIP packaging, Adding testing for AstroMath

- deleted dist, build
- Fixed AstroMath
- Added dev dependencies to package.json
- Added test script to NPM
- Added test folder with astroMath_test.js
- fixed AstroMath and MousePosition
parent b7fb4e7a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -60,9 +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",
+1 −1
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
+1 −1
Original line number Diff line number Diff line
import AstroMath from "./AstroMath";
import "leaflet-fullscreen";
import L from "leaflet";
/**
 * @class MousePosition
 * @aka L.Control.AstroMousePosition
+79 −8
Original line number Diff line number Diff line
import 'jsdom-global/register';
import '../src/js/AstroMath';
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');
  })

var assert = require('assert');
describe('Array', function() {
  describe('#indexOf()', function() {
    it('should return -1 when the value is not present', function(){
      assert.equal(-1, [1,2,3].indexOf(4));
    });
  });
  // 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 6.283185307179586', function() {
    // add an assertion
    let majorRadius = testMath.toRadians(360);
    expect(majorRadius).to.equal(6.283185307179586);
  })

    // testing toDegrees function
    it('Testing toDegrees: 6.283185307179586 degrees should be 360', function() {
      // add an assertion
      let majorRadius = testMath.toDegrees(6.283185307179586);
      expect(majorRadius).to.equal(360);
    })

    // 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 180 ', function() {
      // add an assertion
      let majorRadius = testMath.lonTo360(-180, "");
      expect(majorRadius).to.equal(180);
    })

    // 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
+0 −13
Original line number Diff line number Diff line
Metadata-Version: 1.2
Name: CartoCosmos
Version: 1.0.1
Summary: Virtual planetary mapping
Home-page: https://github.com/CartoCosmos/CartoCosmos
Author: CartoComos Development Team
Author-email: 
License: UNKNOWN
Description: CartoCosmos is a virtual planetary mapping application that allows users to create and view maps of different planetary bodies supported by USGS.
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Loading