mirror of
https://github.com/quantum5/qcal.git
synced 2025-07-27 03:34:11 -04:00
common: add tests for jdnLordOfNight
This commit is contained in:
parent
fb576a4a5e
commit
7a3e62df17
|
@ -1,4 +1,13 @@
|
||||||
import {formatHaab, formatLordOfNight, formatTzolkin, jdnHaab, jdnTzolkin, TzolkinName, tzolkinName} from './mayan';
|
import {
|
||||||
|
formatHaab,
|
||||||
|
formatLordOfNight,
|
||||||
|
formatTzolkin,
|
||||||
|
jdnHaab,
|
||||||
|
jdnLordOfNight,
|
||||||
|
jdnTzolkin,
|
||||||
|
TzolkinName,
|
||||||
|
tzolkinName,
|
||||||
|
} from './mayan';
|
||||||
|
|
||||||
describe('tzolkinName', () => {
|
describe('tzolkinName', () => {
|
||||||
it('should return correct name for IMIX', () => {
|
it('should return correct name for IMIX', () => {
|
||||||
|
@ -191,3 +200,35 @@ describe('formatLordOfNight', () => {
|
||||||
expect(formatLordOfNight(9)).toBe('G9');
|
expect(formatLordOfNight(9)).toBe('G9');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('jdnLordOfNight', () => {
|
||||||
|
it('converts two consecutive cycles correctly', () => {
|
||||||
|
expect(jdnLordOfNight(2460828)).toBe(1);
|
||||||
|
expect(jdnLordOfNight(2460829)).toBe(2);
|
||||||
|
expect(jdnLordOfNight(2460830)).toBe(3);
|
||||||
|
expect(jdnLordOfNight(2460831)).toBe(4);
|
||||||
|
expect(jdnLordOfNight(2460832)).toBe(5);
|
||||||
|
expect(jdnLordOfNight(2460833)).toBe(6);
|
||||||
|
expect(jdnLordOfNight(2460834)).toBe(7);
|
||||||
|
expect(jdnLordOfNight(2460835)).toBe(8);
|
||||||
|
expect(jdnLordOfNight(2460836)).toBe(9);
|
||||||
|
expect(jdnLordOfNight(2460837)).toBe(1);
|
||||||
|
expect(jdnLordOfNight(2460838)).toBe(2);
|
||||||
|
expect(jdnLordOfNight(2460839)).toBe(3);
|
||||||
|
expect(jdnLordOfNight(2460840)).toBe(4);
|
||||||
|
expect(jdnLordOfNight(2460841)).toBe(5);
|
||||||
|
expect(jdnLordOfNight(2460842)).toBe(6);
|
||||||
|
expect(jdnLordOfNight(2460843)).toBe(7);
|
||||||
|
expect(jdnLordOfNight(2460844)).toBe(8);
|
||||||
|
expect(jdnLordOfNight(2460845)).toBe(9);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('converts sample dates from history correctly', () => {
|
||||||
|
expect(jdnLordOfNight(584283)).toBe(1); // Mayan creation
|
||||||
|
expect(jdnLordOfNight(1705426)).toBe(5); // Ides of March
|
||||||
|
expect(jdnLordOfNight(2266296)).toBe(4); // Columbus reaches the Americas
|
||||||
|
expect(jdnLordOfNight(2430336)).toBe(1); // a date which will live in infamy
|
||||||
|
expect(jdnLordOfNight(2440423)).toBe(8); // Moon landing
|
||||||
|
expect(jdnLordOfNight(2458920)).toBe(1); // COVID-19 pandemic
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue