Skip to content

Commit

Permalink
Merge pull request #12 from 0xStarcat/1.0.12
Browse files Browse the repository at this point in the history
1.0.12
  • Loading branch information
0xStarcat authored Mar 30, 2021
2 parents 715eaa5 + a4fc92d commit af0400c
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 81 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ and your language will appear in the results under the `.label` keys supplied wi

## Publishing / Packaging

- update the version number
- Build with `npm run build`
- update the version number in `package.json`
- Build with `npm run build` and commit to branch
- run `npm publish`

## Sources / Special Thanks
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "circular-natal-horoscope-js",
"version": "1.0.11",
"version": "1.0.12",
"description": "",
"main": "dist/index.js",
"module": "src/index.js",
Expand All @@ -14,7 +14,7 @@
"build": "webpack --mode=production",
"build:dev": "webpack",
"build:demo": "webpack -c ./webpack-demo.config.js",
"start:dev": "webpack --watch --mode=production"
"start:dev": "webpack -c ./webpack-demo.config.js --watch --mode=production"
},
"keywords": [
"Astrology",
Expand Down
16 changes: 11 additions & 5 deletions src/Horoscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ export class Horoscope {
this._aspectWithPoints = validateAspectPoints(aspectWithPoints)
this._customOrbs = validateCustomOrbs(customOrbs)

// Remember - Ephemeris requires UTC time!
this.Ephemeris = new Ephemeris({
year: this.origin.year, month: this.origin.month, day: this.origin.date,
hours: this.origin.hour, minutes: this.origin.minute, seconds: this.origin.second,
latitude: parseFloat(this.origin.latitude), longitude: parseFloat(this.origin.longitude),
calculateShadows: false
})
year: this.origin.utcTime.year(),
month: this.origin.utcTime.month(),
day: this.origin.utcTime.date(),
hours: this.origin.utcTime.hour(),
minutes: this.origin.utcTime.minute(),
seconds: this.origin.utcTime.second(),
latitude: parseFloat(this.origin.latitude),
longitude: parseFloat(this.origin.longitude),
calculateShadows: false,
});

this._celestialBodies = this.processCelestialBodies(this.Ephemeris.Results)
this._celestialPoints = this.processCelestialPoints(this.Ephemeris.Results)
Expand Down
8 changes: 5 additions & 3 deletions src/Origin.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ export class Origin {

this.latitude = latitude
this.longitude = longitude
this.timezone = moment.tz.zone(tzlookup(this.latitude, this.longitude))
this.localTime = moment.tz(this.timeObject, this.timezone.name)
this.utcTime = moment.tz(this.timeObject, this.timezone.name).utc()
this.timezone = moment.tz.zone(tzlookup(this.latitude, this.longitude));
this.localTime = moment.tz(this.timeObject, this.timezone.name);
this.localTimeFormatted = this.localTime.format();
this.utcTime = moment.tz(this.timeObject, this.timezone.name).utc(); // `.utc()` mutates the original localTime so don't call it on this.localTime itself.
this.utcTimeFormatted = this.utcTime.format();
this.julianDate = getJulianDate({
year: this.utcTime.year(),
month: this.utcTime.month() + 1,
Expand Down
116 changes: 62 additions & 54 deletions tests/Horoscope.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,65 +260,73 @@ describe('CelestialBodies', () => {
test('origin 1', () => {
const horoscope = new Horoscope({origin: defaultOrigin, zodiac: 'tropical'})
expect(horoscope.CelestialBodies.all.map(b => b.ChartPosition.Ecliptic.DecimalDegrees)).toEqual(
[ 117.4277,
336.3438,
119.2327,
110.5833,
131.7216,
255.2541,
286.4342,
36.405,
348.507,
291.7519,
5.9994,
1.7714 ])
[
117.706,
339.8001,
119.0326,
110.9417,
131.9067,
255.2349,
286.4133,
36.4104,
348.5027,
291.7448,
5.9965,
1.7714
])

expect(horoscope.CelestialBodies.all.map(b => b.ChartPosition.Horizon.DecimalDegrees)).toEqual(
[ 52.0027,
193.0866,
50.1977,
58.8471,
37.7088,
274.1763,
242.9962,
133.0254,
180.9234,
237.6785,
163.431,
167.659 ])
[
51.7244,
189.6303,
50.3978,
58.4887,
37.5237,
274.1955,
243.0171,
133.02,
180.9277,
237.6856,
163.4339,
167.659
])
})
})

describe('sidereal', () => { // same as tropical
test('origin 1', () => {
const horoscope = new Horoscope({origin: defaultOrigin, zodiac: 'sidereal'})
expect(horoscope.CelestialBodies.all.map(b => b.ChartPosition.Ecliptic.DecimalDegrees)).toEqual(
[ 93.3277,
312.2438,
95.1327,
86.4833,
107.6216,
231.1541,
262.3342,
12.305,
324.407,
267.6519,
341.8994,
337.6714 ])
[
93.606,
315.7001,
94.9326,
86.8417,
107.8067,
231.1349,
262.3133,
12.3104,
324.4027,
267.6448,
341.8965,
337.6714,
])

expect(horoscope.CelestialBodies.all.map(b => b.ChartPosition.Horizon.DecimalDegrees)).toEqual(
[ 52.0027,
193.0866,
50.1977,
58.8471,
37.7088,
274.1763,
242.9962,
133.0254,
180.9234,
237.6785,
163.431,
167.659 ])
[
51.7244,
189.6303,
50.3978,
58.4887,
37.5237,
274.1955,
243.0171,
133.02,
180.9277,
237.6856,
163.4339,
167.659
])
})
})

Expand All @@ -337,20 +345,20 @@ describe('CelestialBodies', () => {
const horoscope = new Horoscope({origin: defaultOrigin, zodiac: 'tropical'})

it('returns north node', () => {
expect(horoscope.CelestialPoints.northnode.ChartPosition.Ecliptic.DecimalDegrees).toEqual(106.9588)
expect(horoscope.CelestialPoints.northnode.ChartPosition.Ecliptic.DecimalDegrees).toEqual(106.9434)
expect(horoscope.CelestialPoints.northnode.Sign.label).toEqual("Cancer")
expect(horoscope.CelestialPoints.northnode.House.id).toEqual(10)

})

it('returns south node', () => {
expect(horoscope.CelestialPoints.southnode.ChartPosition.Ecliptic.DecimalDegrees).toEqual(286.9588)
expect(horoscope.CelestialPoints.southnode.ChartPosition.Ecliptic.DecimalDegrees).toEqual(286.9434)
expect(horoscope.CelestialPoints.southnode.Sign.label).toEqual("Capricorn")
expect(horoscope.CelestialPoints.southnode.House.id).toEqual(4)
})

it('returns lilith', () => {
expect(horoscope.CelestialPoints.lilith.ChartPosition.Ecliptic.DecimalDegrees).toEqual(338.7655)
expect(horoscope.CelestialPoints.lilith.ChartPosition.Ecliptic.DecimalDegrees).toEqual(338.798)
expect(horoscope.CelestialPoints.lilith.Sign.label).toEqual("Pisces")
expect(horoscope.CelestialPoints.lilith.House.id).toEqual(6)
})
Expand All @@ -360,17 +368,17 @@ describe('CelestialBodies', () => {
describe('Aspects', () => {
it('returns all aspects', () => {
const horoscope = new Horoscope({origin: defaultOrigin, zodiac: 'tropical', aspectTypes: 'all', aspectPoints: ['bodies', 'points', 'angles'], aspectWithPoints: ['bodies', 'points', 'angles']})
expect(horoscope.Aspects.all).toHaveLength(52)
expect(horoscope.Aspects.all).toHaveLength(53)
})

it('returns all major aspects', () => {
const horoscope = new Horoscope({origin: defaultOrigin, zodiac: 'tropical', aspectTypes: 'major', aspectPoints: ['bodies', 'points', 'angles'], aspectWithPoints: ['bodies', 'points', 'angles']})
expect(horoscope.Aspects.all).toHaveLength(39)
expect(horoscope.Aspects.all).toHaveLength(41)
})

it('returns all minor aspects', () => {
const horoscope = new Horoscope({origin: defaultOrigin, zodiac: 'tropical', aspectTypes: 'minor', aspectPoints: ['bodies', 'points', 'angles'], aspectWithPoints: ['bodies', 'points', 'angles']})
expect(horoscope.Aspects.all).toHaveLength(13)
expect(horoscope.Aspects.all).toHaveLength(12)
})
})
})
28 changes: 14 additions & 14 deletions tests/utilities.aspects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,27 +187,27 @@ describe('createAspects', () => {
const horoscope = new Horoscope({ origin: defaultOrigin, aspectPoints: ['all'] })
const aspects = createAspects(horoscope)

expect(aspects.all).toHaveLength(39)
expect(aspects.all).toHaveLength(41)
expect(aspects.types.conjunction).toHaveLength(8)
expect(aspects.types.opposition).toHaveLength(9)
expect(aspects.types.trine).toHaveLength(10)
expect(aspects.types.square).toHaveLength(5)
expect(aspects.types.trine).toHaveLength(11)
expect(aspects.types.square).toHaveLength(6)
expect(aspects.types.sextile).toHaveLength(7)
expect(aspects.types.quincunx).toBe(undefined)

expect(aspects.points.sun).toHaveLength(4)
expect(aspects.points.moon).toHaveLength(2)
expect(aspects.points.moon).toHaveLength(4)
expect(aspects.points.mercury).toHaveLength(4)
expect(aspects.points.venus).toHaveLength(7)
expect(aspects.points.mars).toHaveLength(3)
expect(aspects.points.jupiter).toHaveLength(5)
expect(aspects.points.jupiter).toHaveLength(6)
expect(aspects.points.saturn).toHaveLength(6)
expect(aspects.points.uranus).toHaveLength(3)
expect(aspects.points.neptune).toHaveLength(8)
expect(aspects.points.pluto).toHaveLength(8)
expect(aspects.points.chiron).toHaveLength(3)
expect(aspects.points.sirius).toHaveLength(3)
expect(aspects.points.northnode).toHaveLength(5)
expect(aspects.points.northnode).toHaveLength(6)
expect(aspects.points.southnode).toHaveLength(5)
expect(aspects.points.ascendant).toHaveLength(7)
expect(aspects.points.midheaven).toHaveLength(2)
Expand All @@ -217,27 +217,27 @@ describe('createAspects', () => {
const horoscope = new Horoscope({ origin: defaultOrigin, aspectPoints: ['all'], customOrbs: { conjunction: 10 } })
const aspects = createAspects(horoscope)

expect(aspects.all).toHaveLength(41)
expect(aspects.types.conjunction).toHaveLength(10)
expect(aspects.all).toHaveLength(44)
expect(aspects.types.conjunction).toHaveLength(11)
expect(aspects.types.opposition).toHaveLength(9)
expect(aspects.types.trine).toHaveLength(10)
expect(aspects.types.square).toHaveLength(5)
expect(aspects.types.trine).toHaveLength(11)
expect(aspects.types.square).toHaveLength(6)
expect(aspects.types.sextile).toHaveLength(7)
expect(aspects.types.quincunx).toBe(undefined)

expect(aspects.points.sun).toHaveLength(4)
expect(aspects.points.moon).toHaveLength(2)
expect(aspects.points.moon).toHaveLength(5)
expect(aspects.points.mercury).toHaveLength(5)
expect(aspects.points.venus).toHaveLength(8)
expect(aspects.points.mars).toHaveLength(3)
expect(aspects.points.jupiter).toHaveLength(5)
expect(aspects.points.jupiter).toHaveLength(6)
expect(aspects.points.saturn).toHaveLength(6)
expect(aspects.points.uranus).toHaveLength(3)
expect(aspects.points.neptune).toHaveLength(9)
expect(aspects.points.neptune).toHaveLength(10)
expect(aspects.points.pluto).toHaveLength(8)
expect(aspects.points.chiron).toHaveLength(3)
expect(aspects.points.sirius).toHaveLength(3)
expect(aspects.points.northnode).toHaveLength(5)
expect(aspects.points.northnode).toHaveLength(6)
expect(aspects.points.southnode).toHaveLength(5)
expect(aspects.points.ascendant).toHaveLength(7)
expect(aspects.points.midheaven).toHaveLength(2)
Expand Down

0 comments on commit af0400c

Please sign in to comment.