-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5573dea
commit 40a28c6
Showing
12 changed files
with
6,976 additions
and
9,465 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,84 @@ | ||
const data = require("../data/dinvishesh.json"); | ||
const index = require("../src/index.js"); | ||
import data from '../data/data.js'; | ||
import { | ||
dinVisheshToday, | ||
dinVishesh, | ||
dinVisheshAll, | ||
dinVisheshByCategory, | ||
} from '../src/index.js'; | ||
|
||
const assert = require("chai").assert; | ||
import chai from 'chai'; | ||
const { assert } = chai; | ||
|
||
describe("dinVisheshToday", () => { | ||
it(`does not return undefined for the current day`, () => { | ||
assert.isDefined(index.dinVisheshToday()); | ||
}); | ||
describe('dinVisheshToday', () => { | ||
it(`does not return undefined for the current day`, () => { | ||
assert.isDefined(dinVisheshToday()); | ||
}); | ||
}); | ||
|
||
describe("dinVishesh", () => { | ||
const categoryMonthDayTheories = [ | ||
["janm", "february", "29"], | ||
["mrutyu", "april", "20"], | ||
["ghatana", "september", "15"] | ||
]; | ||
|
||
categoryMonthDayTheories.map(([category, month, day]) => { | ||
it(`returns data for ${category}/${month}/${day}`, () => { | ||
assert.equal( | ||
index.dinVishesh(category, month, day), | ||
data.category[category][month][day] | ||
); | ||
}); | ||
describe('dinVishesh', () => { | ||
const categoryMonthDayTheories = [ | ||
['janm', 'february', '29'], | ||
['mrutyu', 'april', '20'], | ||
['ghatana', 'september', '15'], | ||
]; | ||
|
||
categoryMonthDayTheories.map(([category, month, day]) => { | ||
it(`returns data for ${category}/${month}/${day}`, () => { | ||
assert.equal( | ||
dinVishesh(category, month, day), | ||
data.category[category][month][day] | ||
); | ||
}); | ||
const categoryMonthTheories = [ | ||
["janm", "february", undefined], | ||
["mrutyu", "april", ""], | ||
["ghatana", "september", ""] | ||
]; | ||
categoryMonthTheories.map(([category, month, day]) => { | ||
it(`returns data for ${category}/${month} without day`, () => { | ||
assert.equal( | ||
index.dinVishesh(category, month, day), | ||
data.category[category][month] | ||
); | ||
}); | ||
}); | ||
|
||
const categoryMonthTheories = [ | ||
['janm', 'february', undefined], | ||
['mrutyu', 'april', ''], | ||
['ghatana', 'september', ''], | ||
]; | ||
|
||
categoryMonthTheories.map(([category, month, day]) => { | ||
it(`returns data for ${category}/${month} without day`, () => { | ||
assert.equal( | ||
dinVishesh(category, month, day), | ||
data.category[category][month] | ||
); | ||
}); | ||
|
||
const categoryTheories = [ | ||
["janm", undefined, undefined], | ||
["mrutyu", "", ""], | ||
["ghatana", "", ""], | ||
]; | ||
|
||
categoryTheories.map(([category, month, day]) => { | ||
it(`returns data for ${category} without month or day`, () => { | ||
assert.equal( | ||
index.dinVishesh(category, month, day), | ||
data.category[category] | ||
); | ||
}); | ||
}); | ||
|
||
const categoryTheories = [ | ||
['janm', undefined, undefined], | ||
['mrutyu', '', ''], | ||
['ghatana', '', ''], | ||
]; | ||
|
||
categoryTheories.map(([category, month, day]) => { | ||
it(`returns data for ${category} without month or day`, () => { | ||
assert.equal(dinVishesh(category, month, day), data.category[category]); | ||
}); | ||
}); | ||
}); | ||
|
||
describe("dinVisheshAll", () => { | ||
it("returns the same data as in dinvishesh.json", () => { | ||
assert.equal(index.dinVisheshAll(), data); | ||
}); | ||
describe('dinVisheshAll', () => { | ||
it('returns the same data as in dinvishesh.json', () => { | ||
assert.equal(dinVisheshAll(), data); | ||
}); | ||
}); | ||
|
||
describe("dinVisheshByCategory", () => { | ||
const definedTheories = [ | ||
["janm"], | ||
["mrutyu"], | ||
["ghatana"] | ||
]; | ||
|
||
definedTheories.map(([category]) => { | ||
it(`returns data from dinvishesh.json for category ${category}`, () => { | ||
assert.equal( | ||
index.dinVisheshByCategory(category), | ||
data.category[category] | ||
); | ||
}); | ||
describe('dinVisheshByCategory', () => { | ||
const definedTheories = [['janm'], ['mrutyu'], ['ghatana']]; | ||
|
||
definedTheories.map(([category]) => { | ||
it(`returns data from dinvishesh.json for category ${category}`, () => { | ||
assert.equal(dinVisheshByCategory(category), data.category[category]); | ||
}); | ||
|
||
const undefinedTheories = [ | ||
["foo"], | ||
["bar"], | ||
["baz"], | ||
]; | ||
|
||
undefinedTheories.map(([category]) => { | ||
it(`returns undefined for missing category ${category}`, () => { | ||
assert.isUndefined(index.dinVisheshByCategory("foo")); | ||
}); | ||
}); | ||
|
||
const undefinedTheories = [['foo'], ['bar'], ['baz']]; | ||
|
||
undefinedTheories.map(([category]) => { | ||
it(`returns undefined for missing category ${category}`, () => { | ||
assert.isUndefined(dinVisheshByCategory('foo')); | ||
}); | ||
}); | ||
}); | ||
}); |