mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-27 01:19:52 -04:00
TESTS: moar better tests...
* also bug fixes in strongs...
This commit is contained in:
parent
ded7e1980d
commit
57598b99a9
@ -1,292 +1,305 @@
|
|||||||
import { Reference } from './Reference';
|
import {Reference} from './Reference';
|
||||||
|
|
||||||
describe('Reference', () => {
|
describe('Reference', () =>
|
||||||
|
{
|
||||||
|
|
||||||
it('Should parse the reference: Gen 1:1', () => {
|
it('Should parse the reference: Gen 1:1', () =>
|
||||||
let ref = new Reference("Gen 1:1").toString();
|
{
|
||||||
expect(ref).toBe('Genesis 1:1');
|
let ref = new Reference("Gen 1:1").toString();
|
||||||
|
expect(ref).toBe('Genesis 1:1');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should parse the reference: Gen 1:1-11', () =>
|
||||||
|
{
|
||||||
|
let ref = new Reference("Gen 1:1-11").toString();
|
||||||
|
expect(ref).toBe('Genesis 1:1 - 11');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should parse the reference: Gen 1-2', () =>
|
||||||
|
{
|
||||||
|
let ref = new Reference("Gen 1-2").toString();
|
||||||
|
expect(ref).toBe('Genesis 1:1 - 2:*');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should parse the reference: John 3:16', () =>
|
||||||
|
{
|
||||||
|
let ref = new Reference("John 3:16").toString();
|
||||||
|
expect(ref).toBe('John 3:16');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should parse the reference: John 3-6', () =>
|
||||||
|
{
|
||||||
|
let ref = new Reference("Jn 3-6").toString();
|
||||||
|
expect(ref).toBe('John 3:1 - 6:*');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should parse the reference: 1 Corinthians 3:5-6:5', () =>
|
||||||
|
{
|
||||||
|
let ref = new Reference("1 Corinthians 3:5-6:5").toString();
|
||||||
|
expect(ref).toBe('1 Corinthians 3:5 - 6:5');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should parse the reference: 2 Samuel 5:5-6:5', () =>
|
||||||
|
{
|
||||||
|
expect(new Reference("II sam 5:5-6:5").toString()).toBe('2 Samuel 5:5 - 6:5');
|
||||||
|
});
|
||||||
|
|
||||||
|
let booknames = [
|
||||||
|
{"abbr": "gen", "actual": "Genesis"},
|
||||||
|
{"abbr": "ge", "actual": "Genesis"},
|
||||||
|
{"abbr": "genesis", "actual": "Genesis"},
|
||||||
|
{"abbr": "gn", "actual": "Genesis"},
|
||||||
|
{"abbr": "exodus", "actual": "Exodus"},
|
||||||
|
{"abbr": "ex", "actual": "Exodus"},
|
||||||
|
{"abbr": "exo", "actual": "Exodus"},
|
||||||
|
{"abbr": "exod", "actual": "Exodus"},
|
||||||
|
{"abbr": "exd", "actual": "Exodus"},
|
||||||
|
{"abbr": "leviticus", "actual": "Leviticus"},
|
||||||
|
{"abbr": "lev", "actual": "Leviticus"},
|
||||||
|
{"abbr": "le", "actual": "Leviticus"},
|
||||||
|
{"abbr": "levi", "actual": "Leviticus"},
|
||||||
|
{"abbr": "lv", "actual": "Leviticus"},
|
||||||
|
{"abbr": "numbers", "actual": "Numbers"},
|
||||||
|
{"abbr": "num", "actual": "Numbers"},
|
||||||
|
{"abbr": "nu", "actual": "Numbers"},
|
||||||
|
{"abbr": "numb", "actual": "Numbers"},
|
||||||
|
{"abbr": "number", "actual": "Numbers"},
|
||||||
|
{"abbr": "deuteronomy", "actual": "Deuteronomy"},
|
||||||
|
{"abbr": "deut", "actual": "Deuteronomy"},
|
||||||
|
{"abbr": "de", "actual": "Deuteronomy"},
|
||||||
|
{"abbr": "dt", "actual": "Deuteronomy"},
|
||||||
|
{"abbr": "deu", "actual": "Deuteronomy"},
|
||||||
|
{"abbr": "joshua", "actual": "Joshua"},
|
||||||
|
{"abbr": "josh", "actual": "Joshua"},
|
||||||
|
{"abbr": "jos", "actual": "Joshua"},
|
||||||
|
{"abbr": "judges", "actual": "Judges"},
|
||||||
|
{"abbr": "jud", "actual": "Judges"},
|
||||||
|
{"abbr": "jdg", "actual": "Judges"},
|
||||||
|
{"abbr": "judg", "actual": "Judges"},
|
||||||
|
{"abbr": "ruth", "actual": "Ruth"},
|
||||||
|
{"abbr": "ru", "actual": "Ruth"},
|
||||||
|
{"abbr": "1 samuel", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "1 sa", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "1 sam", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "1 sml", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "i samuel", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "i sa", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "i sam", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "i sml", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "1st samuel", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "1st sa", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "1st sam", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "1st sml", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "first samuel", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "first sa", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "first sam", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "first sml", "actual": "1 Samuel"},
|
||||||
|
{"abbr": "2 samuel", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "2 sa", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "2 sam", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "2 sml", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "ii samuel", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "ii sa", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "ii sam", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "ii sml", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "2nd samuel", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "2nd sa", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "2nd sam", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "2nd sml", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "second samuel", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "second sa", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "second sam", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "second sml", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "sec samuel", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "sec sa", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "sec sam", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "sec sml", "actual": "2 Samuel"},
|
||||||
|
{"abbr": "1 kings", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1 king", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1 kgs", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1 kn", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1 k", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1 ki", "actual": "1 Kings"},
|
||||||
|
{"abbr": "i kings", "actual": "1 Kings"},
|
||||||
|
{"abbr": "i king", "actual": "1 Kings"},
|
||||||
|
{"abbr": "i kgs", "actual": "1 Kings"},
|
||||||
|
{"abbr": "i kn", "actual": "1 Kings"},
|
||||||
|
{"abbr": "i k", "actual": "1 Kings"},
|
||||||
|
{"abbr": "i ki", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1st kings", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1st king", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1st kgs", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1st kn", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1st k", "actual": "1 Kings"},
|
||||||
|
{"abbr": "1st ki", "actual": "1 Kings"},
|
||||||
|
{"abbr": "first kings", "actual": "1 Kings"},
|
||||||
|
{"abbr": "first king", "actual": "1 Kings"},
|
||||||
|
{"abbr": "first kgs", "actual": "1 Kings"},
|
||||||
|
{"abbr": "first kn", "actual": "1 Kings"},
|
||||||
|
{"abbr": "first k", "actual": "1 Kings"},
|
||||||
|
{"abbr": "first ki", "actual": "1 Kings"},
|
||||||
|
{"abbr": "2 Kings", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2 king", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2 kgs", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2 kn", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2 k", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2 ki", "actual": "2 Kings"},
|
||||||
|
{"abbr": "ii kings", "actual": "2 Kings"},
|
||||||
|
{"abbr": "ii king", "actual": "2 Kings"},
|
||||||
|
{"abbr": "ii kgs", "actual": "2 Kings"},
|
||||||
|
{"abbr": "ii kn", "actual": "2 Kings"},
|
||||||
|
{"abbr": "ii k", "actual": "2 Kings"},
|
||||||
|
{"abbr": "ii ki", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2nd kings", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2nd king", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2nd kgs", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2nd kn", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2nd k", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2nd ki", "actual": "2 Kings"},
|
||||||
|
{"abbr": "second kings", "actual": "2 Kings"},
|
||||||
|
{"abbr": "second king", "actual": "2 Kings"},
|
||||||
|
{"abbr": "second kgs", "actual": "2 Kings"},
|
||||||
|
{"abbr": "second kn", "actual": "2 Kings"},
|
||||||
|
{"abbr": "second k", "actual": "2 Kings"},
|
||||||
|
{"abbr": "second ki", "actual": "2 Kings"},
|
||||||
|
{"abbr": "sec kings", "actual": "2 Kings"},
|
||||||
|
{"abbr": "sec king", "actual": "2 Kings"},
|
||||||
|
{"abbr": "sec kgs", "actual": "2 Kings"},
|
||||||
|
{"abbr": "sec kn", "actual": "2 Kings"},
|
||||||
|
{"abbr": "sec k", "actual": "2 Kings"},
|
||||||
|
{"abbr": "sec ki", "actual": "2 Kings"},
|
||||||
|
{"abbr": "2 Chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2 chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2 chron", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2 ch", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2 chr", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "ii Chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "ii chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "ii chron", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "ii ch", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "ii chr", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2nd Chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2nd chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2nd chron", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2nd ch", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "2nd chr", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "second Chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "second chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "second chron", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "second ch", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "second chr", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "sec Chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "sec chronicles", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "sec chron", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "sec ch", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "sec chr", "actual": "2 Chronicles"},
|
||||||
|
{"abbr": "1 Chronicles", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1 chronicles", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1 chron", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1 ch", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1 chr", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "i Chronicles", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "i chronicles", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "i chron", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "i ch", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "i chr", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1st Chronicles", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1st chronicles", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1st chron", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1st ch", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "1st chr", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "first Chronicles", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "first chronicles", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "first chron", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "first ch", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "first chr", "actual": "1 Chronicles"},
|
||||||
|
{"abbr": "ezra", "actual": "Ezra"},
|
||||||
|
{"abbr": "ezr", "actual": "Ezra"},
|
||||||
|
{"abbr": "nehemiah", "actual": "Nehemiah"},
|
||||||
|
{"abbr": "neh", "actual": "Nehemiah"},
|
||||||
|
{"abbr": "ne", "actual": "Nehemiah"},
|
||||||
|
{"abbr": "nehamiah", "actual": "Nehemiah"},
|
||||||
|
{"abbr": "esther", "actual": "Esther"},
|
||||||
|
{"abbr": "est", "actual": "Esther"},
|
||||||
|
{"abbr": "es", "actual": "Esther"},
|
||||||
|
{"abbr": "esth", "actual": "Esther"},
|
||||||
|
{"abbr": "job", "actual": "Job"},
|
||||||
|
{"abbr": "jo", "actual": "Job"},
|
||||||
|
{"abbr": "jb", "actual": "Job"},
|
||||||
|
{"abbr": "psalms", "actual": "Psalm"},
|
||||||
|
{"abbr": "ps", "actual": "Psalm"},
|
||||||
|
{"abbr": "psa", "actual": "Psalm"},
|
||||||
|
{"abbr": "psalm", "actual": "Psalm"},
|
||||||
|
{"abbr": "psm", "actual": "Psalm"},
|
||||||
|
{"abbr": "proverbs", "actual": "Proverbs"},
|
||||||
|
{"abbr": "prov", "actual": "Proverbs"},
|
||||||
|
{"abbr": "pr", "actual": "Proverbs"},
|
||||||
|
{"abbr": "pro", "actual": "Proverbs"},
|
||||||
|
{"abbr": "proverb", "actual": "Proverbs"},
|
||||||
|
{"abbr": "prv", "actual": "Proverbs"},
|
||||||
|
{"abbr": "prvbs", "actual": "Proverbs"},
|
||||||
|
{"abbr": "ecclesiastes", "actual": "Ecclesiastes"},
|
||||||
|
{"abbr": "eccl", "actual": "Ecclesiastes"},
|
||||||
|
{"abbr": "ecc", "actual": "Ecclesiastes"},
|
||||||
|
{"abbr": "eccles", "actual": "Ecclesiastes"},
|
||||||
|
{"abbr": "ec", "actual": "Ecclesiastes"},
|
||||||
|
{"abbr": "ecl", "actual": "Ecclesiastes"},
|
||||||
|
{"abbr": "ecclesiaste", "actual": "Ecclesiastes"},
|
||||||
|
{"abbr": "song of solomon", "actual": "Song of Solomon"},
|
||||||
|
{"abbr": "song of songs", "actual": "Song of Solomon"},
|
||||||
|
{"abbr": "sos", "actual": "Song of Solomon"},
|
||||||
|
{"abbr": "ss", "actual": "Song of Solomon"},
|
||||||
|
{"abbr": "son", "actual": "Song of Solomon"},
|
||||||
|
{"abbr": "so", "actual": "Song of Solomon"},
|
||||||
|
{"abbr": "song", "actual": "Song of Solomon"},
|
||||||
|
{"abbr": "songs", "actual": "Song of Solomon"},
|
||||||
|
{"abbr": "isaiah", "actual": "Isaiah"},
|
||||||
|
{"abbr": "is", "actual": "Isaiah"},
|
||||||
|
{"abbr": "isah", "actual": "Isaiah"},
|
||||||
|
{"abbr": "isai", "actual": "Isaiah"},
|
||||||
|
{"abbr": "ia", "actual": "Isaiah"},
|
||||||
|
{"abbr": "jerimiah", "actual": "Jeremiah"},
|
||||||
|
{"abbr": "jeremiah", "actual": "Jeremiah"},
|
||||||
|
{"abbr": "jer", "actual": "Jeremiah"},
|
||||||
|
{"abbr": "je", "actual": "Jeremiah"},
|
||||||
|
{"abbr": "jere", "actual": "Jeremiah"},
|
||||||
|
{"abbr": "lamentations", "actual": "Lamentations"},
|
||||||
|
{"abbr": "lam", "actual": "Lamentations"},
|
||||||
|
{"abbr": "la", "actual": "Lamentations"},
|
||||||
|
{"abbr": "lamentation", "actual": "Lamentations"},
|
||||||
|
];
|
||||||
|
|
||||||
|
for (let bk of booknames)
|
||||||
|
{
|
||||||
|
it('Should parse the references: ' + bk.abbr, () =>
|
||||||
|
{
|
||||||
|
let book = Reference.parseBook(bk.abbr);
|
||||||
|
expect(book.bookname).toBe(bk.actual);
|
||||||
|
for (let i = 1; i <= book.lastchapter; i++)
|
||||||
|
expect(new Reference(bk.abbr + ' ' + i).toString()).toBe(bk.actual + ' ' + i + ":1 - *");
|
||||||
|
|
||||||
|
for (let i = 1; i < book.lastchapter; i++)
|
||||||
|
{
|
||||||
|
expect(new Reference(bk.abbr + ' ' + i + '-' + (i + 1)).toString()).toBe(bk.actual + ' ' + i + ":1 - " + (i + 1) + ":*");
|
||||||
|
expect(new Reference(bk.abbr + ' ' + i + ':3-' + (i + 1) + ":6").toString()).toBe(bk.actual + ' ' + i + ":3 - " + (i + 1) + ":6");
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(new Reference(bk.abbr + ' 1:4-2:5').toString()).toBe(bk.actual + ' 1:4 - 2:5');
|
||||||
|
expect(new Reference(bk.abbr + ' 1:1 - 5').toString()).toBe(bk.actual + ' 1:1 - 5');
|
||||||
|
expect(new Reference(bk.abbr + ' 1:4 - 5').toString()).toBe(bk.actual + ' 1:4 - 5');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
let refs = [
|
||||||
|
{"src": "2 sam 3:4-6:8", "actual": "2 Samuel 3:4 - 6:8"},
|
||||||
|
//{ "src": "gen 50 - ex 2", "actual": "Genesis 50:1 - Exodus 2:*" },
|
||||||
|
];
|
||||||
|
|
||||||
it('Should parse the reference: Gen 1:1-11', () => {
|
for (let ref of refs)
|
||||||
let ref = new Reference("Gen 1:1-11").toString();
|
{
|
||||||
expect(ref).toBe('Genesis 1:1 - 11');
|
it('Should parse the reference: ' + ref.src, () =>
|
||||||
|
{
|
||||||
|
expect(new Reference(ref.src).toString()).toBe(ref.actual);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
it('Should parse the reference: Gen 1-2', () => {
|
|
||||||
let ref = new Reference("Gen 1-2").toString();
|
|
||||||
expect(ref).toBe('Genesis 1:1 - 2:*');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should parse the reference: John 3:16', () => {
|
|
||||||
let ref = new Reference("John 3:16").toString();
|
|
||||||
expect(ref).toBe('John 3:16');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should parse the reference: John 3-6', () => {
|
|
||||||
let ref = new Reference("Jn 3-6").toString();
|
|
||||||
expect(ref).toBe('John 3:1 - 6:*');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should parse the reference: 1 Corinthians 3:5-6:5', () => {
|
|
||||||
let ref = new Reference("1 Corinthians 3:5-6:5").toString();
|
|
||||||
expect(ref).toBe('1 Corinthians 3:5 - 6:5');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should parse the reference: 2 Samuel 5:5-6:5', () => {
|
|
||||||
expect(new Reference("II sam 5:5-6:5").toString()).toBe('2 Samuel 5:5 - 6:5');
|
|
||||||
});
|
|
||||||
|
|
||||||
let booknames = [
|
|
||||||
{ "abbr": "gen", "actual": "Genesis" },
|
|
||||||
{ "abbr": "ge", "actual": "Genesis" },
|
|
||||||
{ "abbr": "genesis", "actual": "Genesis" },
|
|
||||||
{ "abbr": "gn", "actual": "Genesis" },
|
|
||||||
{ "abbr": "exodus", "actual": "Exodus" },
|
|
||||||
{ "abbr": "ex", "actual": "Exodus" },
|
|
||||||
{ "abbr": "exo", "actual": "Exodus" },
|
|
||||||
{ "abbr": "exod", "actual": "Exodus" },
|
|
||||||
{ "abbr": "exd", "actual": "Exodus" },
|
|
||||||
{ "abbr": "leviticus", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "lev", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "le", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "levi", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "lv", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "numbers", "actual": "Numbers" },
|
|
||||||
{ "abbr": "num", "actual": "Numbers" },
|
|
||||||
{ "abbr": "nu", "actual": "Numbers" },
|
|
||||||
{ "abbr": "numb", "actual": "Numbers" },
|
|
||||||
{ "abbr": "number", "actual": "Numbers" },
|
|
||||||
{ "abbr": "deuteronomy", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "deut", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "de", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "dt", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "deu", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "joshua", "actual": "Joshua" },
|
|
||||||
{ "abbr": "josh", "actual": "Joshua" },
|
|
||||||
{ "abbr": "jos", "actual": "Joshua" },
|
|
||||||
{ "abbr": "judges", "actual": "Judges" },
|
|
||||||
{ "abbr": "jud", "actual": "Judges" },
|
|
||||||
{ "abbr": "jdg", "actual": "Judges" },
|
|
||||||
{ "abbr": "judg", "actual": "Judges" },
|
|
||||||
{ "abbr": "ruth", "actual": "Ruth" },
|
|
||||||
{ "abbr": "ru", "actual": "Ruth" },
|
|
||||||
{ "abbr": "1 samuel", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1 sa", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1 sam", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1 sml", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "i samuel", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "i sa", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "i sam", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "i sml", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1st samuel", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1st sa", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1st sam", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1st sml", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "first samuel", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "first sa", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "first sam", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "first sml", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "2 samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2 sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2 sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2 sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "ii samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "ii sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "ii sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "ii sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2nd samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2nd sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2nd sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2nd sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "second samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "second sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "second sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "second sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "sec samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "sec sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "sec sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "sec sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "1 kings", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 king", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 kgs", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 kn", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 k", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 ki", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i kings", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i king", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i kgs", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i kn", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i k", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i ki", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st kings", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st king", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st kgs", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st kn", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st k", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st ki", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first kings", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first king", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first kgs", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first kn", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first k", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first ki", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "2 Kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2 chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2 chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2 ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2 chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "1 Chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1 chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1 chron", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1 ch", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1 chr", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i Chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i chron", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i ch", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i chr", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st Chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st chron", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st ch", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st chr", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first Chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first chron", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first ch", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first chr", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "ezra", "actual": "Ezra" },
|
|
||||||
{ "abbr": "ezr", "actual": "Ezra" },
|
|
||||||
{ "abbr": "nehemiah", "actual": "Nehemiah" },
|
|
||||||
{ "abbr": "neh", "actual": "Nehemiah" },
|
|
||||||
{ "abbr": "ne", "actual": "Nehemiah" },
|
|
||||||
{ "abbr": "nehamiah", "actual": "Nehemiah" },
|
|
||||||
{ "abbr": "esther", "actual": "Esther" },
|
|
||||||
{ "abbr": "est", "actual": "Esther" },
|
|
||||||
{ "abbr": "es", "actual": "Esther" },
|
|
||||||
{ "abbr": "esth", "actual": "Esther" },
|
|
||||||
{ "abbr": "job", "actual": "Job" },
|
|
||||||
{ "abbr": "jo", "actual": "Job" },
|
|
||||||
{ "abbr": "jb", "actual": "Job" },
|
|
||||||
{ "abbr": "psalms", "actual": "Psalm" },
|
|
||||||
{ "abbr": "ps", "actual": "Psalm" },
|
|
||||||
{ "abbr": "psa", "actual": "Psalm" },
|
|
||||||
{ "abbr": "psalm", "actual": "Psalm" },
|
|
||||||
{ "abbr": "psm", "actual": "Psalm" },
|
|
||||||
{ "abbr": "proverbs", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "prov", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "pr", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "pro", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "proverb", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "prv", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "prvbs", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "ecclesiastes", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "eccl", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "ecc", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "eccles", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "ec", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "ecl", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "ecclesiaste", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "song of solomon", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "song of songs", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "sos", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "ss", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "son", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "so", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "song", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "songs", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "isaiah", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "is", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "isah", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "isai", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "ia", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "jerimiah", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "jeremiah", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "jer", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "je", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "jere", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "lamentations", "actual": "Lamentations" },
|
|
||||||
{ "abbr": "lam", "actual": "Lamentations" },
|
|
||||||
{ "abbr": "la", "actual": "Lamentations" },
|
|
||||||
{ "abbr": "lamentation", "actual": "Lamentations" },
|
|
||||||
];
|
|
||||||
|
|
||||||
for (let bk of booknames) {
|
|
||||||
it('Should parse the references: ' + bk.abbr, () => {
|
|
||||||
let book = Reference.parseBook(bk.abbr);
|
|
||||||
expect(book.bookname).toBe(bk.actual);
|
|
||||||
for (let i = 1; i <= book.lastchapter; i++)
|
|
||||||
expect(new Reference(bk.abbr + ' ' + i).toString()).toBe(bk.actual + ' ' + i + ":1 - *");
|
|
||||||
|
|
||||||
for (let i = 1; i < book.lastchapter; i++) {
|
|
||||||
expect(new Reference(bk.abbr + ' ' + i + '-' + (i + 1)).toString()).toBe(bk.actual + ' ' + i + ":1 - " + (i + 1) + ":*");
|
|
||||||
expect(new Reference(bk.abbr + ' ' + i + ':3-' + (i + 1)+":6").toString()).toBe(bk.actual + ' ' + i + ":3 - " + (i + 1) + ":6");
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(new Reference(bk.abbr + ' 1:4-2:5').toString()).toBe(bk.actual + ' 1:4 - 2:5');
|
|
||||||
expect(new Reference(bk.abbr + ' 1:1 - 5').toString()).toBe(bk.actual + ' 1:1 - 5');
|
|
||||||
expect(new Reference(bk.abbr + ' 1:4 - 5').toString()).toBe(bk.actual + ' 1:4 - 5');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let refs = [
|
|
||||||
{ "src": "2 sam 3:4-6:8", "actual": "2 Samuel 3:4 - 6:8" },
|
|
||||||
//{ "src": "gen 50 - ex 2", "actual": "Genesis 50:1 - Exodus 2:*" },
|
|
||||||
];
|
|
||||||
|
|
||||||
for (let ref of refs) {
|
|
||||||
it('Should parse the reference: ' + ref.src, () => {
|
|
||||||
expect(new Reference(ref.src).toString()).toBe(ref.actual);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1,312 +1,98 @@
|
|||||||
import { getTestBed, TestBed, inject } from '@angular/core/testing';
|
import {getTestBed, TestBed, inject} from '@angular/core/testing';
|
||||||
import { XHRBackend, BaseRequestOptions, HttpModule, Http, } from '@angular/http';
|
import {XHRBackend, BaseRequestOptions, HttpModule, Http,} from '@angular/http';
|
||||||
import { MockBackend } from '@angular/http/testing';
|
import {MockBackend} from '@angular/http/testing';
|
||||||
import { BibleService } from './bible-service';
|
import {BibleService} from './bible-service';
|
||||||
import { Reference } from './Reference';
|
import {Reference} from './Reference';
|
||||||
|
|
||||||
describe('Bible Service', () => {
|
describe('Bible Service', () =>
|
||||||
beforeEach(() => {
|
{
|
||||||
TestBed.configureTestingModule({
|
beforeEach(() =>
|
||||||
imports: [HttpModule],
|
{
|
||||||
providers: [
|
TestBed.configureTestingModule({
|
||||||
BibleService,
|
imports: [HttpModule],
|
||||||
{
|
providers: [
|
||||||
provide: Http,
|
BibleService,
|
||||||
useFactory: function (backend, defaultOptions) {
|
{
|
||||||
return new Http(backend, defaultOptions);
|
provide: Http,
|
||||||
},
|
useFactory: function (backend, defaultOptions)
|
||||||
deps: [MockBackend, BaseRequestOptions]
|
{
|
||||||
},
|
return new Http(backend, defaultOptions);
|
||||||
MockBackend,
|
},
|
||||||
BaseRequestOptions
|
deps: [MockBackend, BaseRequestOptions]
|
||||||
]
|
},
|
||||||
});
|
MockBackend,
|
||||||
|
BaseRequestOptions
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Should get the verse: Gen 1:1', () => {
|
it('Should get the verse: Gen 1:1', () =>
|
||||||
let svc: BibleService = getTestBed().get(BibleService);
|
{
|
||||||
let ref = new Reference("Gen 1:1").Section;
|
let svc: BibleService = getTestBed().get(BibleService);
|
||||||
var r = svc.getResult(ref);
|
let ref = new Reference("Gen 1:1").Section;
|
||||||
|
var r = svc.getResult(ref);
|
||||||
|
|
||||||
expect(r.msg).toBe(':)');
|
expect(r.msg).toBe(':)');
|
||||||
expect(r.ref).toBe('Genesis 1:1');
|
expect(r.ref).toBe('Genesis 1:1');
|
||||||
expect(r.status).toBe(0);
|
expect(r.status).toBe(0);
|
||||||
expect(r.testament).toBe("old");
|
expect(r.testament).toBe("old");
|
||||||
|
|
||||||
expect(r.cs.length).toBe(1);
|
expect(r.cs.length).toBe(1);
|
||||||
expect(r.cs[0].vss.length).toBe(1);
|
expect(r.cs[0].vss.length).toBe(1);
|
||||||
expect(r.cs[0].vss[0].w.length).toBe(9);
|
expect(r.cs[0].vss[0].w.length).toBe(9);
|
||||||
expect(r.cs[0].vss[0].w[0].t).toBe("In the");
|
expect(r.cs[0].vss[0].w[0].t).toBe("In the");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should get the passage: Gen 1:1-9', () => {
|
it('Should get the passage: Gen 1:1-9', () =>
|
||||||
let svc: BibleService = getTestBed().get(BibleService);
|
{
|
||||||
let ref = new Reference("Gen 1:1-9").Section;
|
let svc: BibleService = getTestBed().get(BibleService);
|
||||||
var r = svc.getResult(ref);
|
let ref = new Reference("Gen 1:1-9").Section;
|
||||||
|
var r = svc.getResult(ref);
|
||||||
|
|
||||||
expect(r.msg).toBe(':)');
|
expect(r.msg).toBe(':)');
|
||||||
expect(r.ref).toBe('Genesis 1:1 - 9');
|
expect(r.ref).toBe('Genesis 1:1 - 9');
|
||||||
expect(r.status).toBe(0);
|
expect(r.status).toBe(0);
|
||||||
expect(r.testament).toBe("old");
|
expect(r.testament).toBe("old");
|
||||||
|
|
||||||
expect(r.cs.length).toBe(1);
|
expect(r.cs.length).toBe(1);
|
||||||
expect(r.cs[0].vss.length).toBe(9);
|
expect(r.cs[0].vss.length).toBe(9);
|
||||||
expect(r.cs[0].vss[0].w.length).toBe(9);
|
expect(r.cs[0].vss[0].w.length).toBe(9);
|
||||||
expect(r.cs[0].vss[0].w[0].t).toBe("In the");
|
expect(r.cs[0].vss[0].w[0].t).toBe("In the");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should return an error status', () => {
|
it('Should return an error status', () =>
|
||||||
let svc: BibleService = getTestBed().get(BibleService);
|
{
|
||||||
let ref = new Reference("Gen 100:1").Section;
|
let svc: BibleService = getTestBed().get(BibleService);
|
||||||
var r = svc.getResult(ref);
|
let ref = new Reference("Gen 100:1").Section;
|
||||||
|
var r = svc.getResult(ref);
|
||||||
|
|
||||||
expect(r.msg).toBe('Unable to retrieve bible passage Genesis 100:1.');
|
expect(r.msg).toBe('Unable to retrieve bible passage Genesis 100:1.');
|
||||||
expect(r.ref).toBe("Genesis 100:1");
|
expect(r.ref).toBe("Genesis 100:1");
|
||||||
expect(r.status).toBe(-1);
|
expect(r.status).toBe(-1);
|
||||||
expect(r.testament).toBe('');
|
expect(r.testament).toBe('');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
let booknames = [
|
for (let j = 1; j < 67; j++)
|
||||||
{ "abbr": "gen", "actual": "Genesis" },
|
{
|
||||||
{ "abbr": "ge", "actual": "Genesis" },
|
let name = Reference.bookName(j);
|
||||||
{ "abbr": "genesis", "actual": "Genesis" },
|
let book = Reference.parseBook(name);
|
||||||
{ "abbr": "gn", "actual": "Genesis" },
|
for (let i = 1; i <= book.lastchapter; i++)
|
||||||
{ "abbr": "exodus", "actual": "Exodus" },
|
{
|
||||||
{ "abbr": "ex", "actual": "Exodus" },
|
it('Get Data for: ' + name + " " + i, () =>
|
||||||
{ "abbr": "exo", "actual": "Exodus" },
|
|
||||||
{ "abbr": "exod", "actual": "Exodus" },
|
|
||||||
{ "abbr": "exd", "actual": "Exodus" },
|
|
||||||
{ "abbr": "leviticus", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "lev", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "le", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "levi", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "lv", "actual": "Leviticus" },
|
|
||||||
{ "abbr": "numbers", "actual": "Numbers" },
|
|
||||||
{ "abbr": "num", "actual": "Numbers" },
|
|
||||||
{ "abbr": "nu", "actual": "Numbers" },
|
|
||||||
{ "abbr": "numb", "actual": "Numbers" },
|
|
||||||
{ "abbr": "number", "actual": "Numbers" },
|
|
||||||
{ "abbr": "deuteronomy", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "deut", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "de", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "dt", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "deu", "actual": "Deuteronomy" },
|
|
||||||
{ "abbr": "joshua", "actual": "Joshua" },
|
|
||||||
{ "abbr": "josh", "actual": "Joshua" },
|
|
||||||
{ "abbr": "jos", "actual": "Joshua" },
|
|
||||||
{ "abbr": "judges", "actual": "Judges" },
|
|
||||||
{ "abbr": "jud", "actual": "Judges" },
|
|
||||||
{ "abbr": "jdg", "actual": "Judges" },
|
|
||||||
{ "abbr": "judg", "actual": "Judges" },
|
|
||||||
{ "abbr": "ruth", "actual": "Ruth" },
|
|
||||||
{ "abbr": "ru", "actual": "Ruth" },
|
|
||||||
{ "abbr": "1 samuel", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1 sa", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1 sam", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1 sml", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "i samuel", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "i sa", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "i sam", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "i sml", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1st samuel", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1st sa", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1st sam", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "1st sml", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "first samuel", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "first sa", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "first sam", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "first sml", "actual": "1 Samuel" },
|
|
||||||
{ "abbr": "2 samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2 sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2 sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2 sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "ii samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "ii sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "ii sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "ii sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2nd samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2nd sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2nd sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "2nd sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "second samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "second sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "second sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "second sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "sec samuel", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "sec sa", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "sec sam", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "sec sml", "actual": "2 Samuel" },
|
|
||||||
{ "abbr": "1 kings", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 king", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 kgs", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 kn", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 k", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1 ki", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i kings", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i king", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i kgs", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i kn", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i k", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "i ki", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st kings", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st king", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st kgs", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st kn", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st k", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "1st ki", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first kings", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first king", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first kgs", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first kn", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first k", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "first ki", "actual": "1 Kings" },
|
|
||||||
{ "abbr": "2 Kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "ii ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2nd ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "second ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec kings", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec king", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec kgs", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec kn", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec k", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "sec ki", "actual": "2 Kings" },
|
|
||||||
{ "abbr": "2 Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2 chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2 chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2 ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2 chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "ii chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "2nd chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "second chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec Chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec chronicles", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec chron", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec ch", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "sec chr", "actual": "2 Chronicles" },
|
|
||||||
{ "abbr": "1 Chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1 chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1 chron", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1 ch", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1 chr", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i Chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i chron", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i ch", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "i chr", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st Chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st chron", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st ch", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "1st chr", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first Chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first chronicles", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first chron", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first ch", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "first chr", "actual": "1 Chronicles" },
|
|
||||||
{ "abbr": "ezra", "actual": "Ezra" },
|
|
||||||
{ "abbr": "ezr", "actual": "Ezra" },
|
|
||||||
{ "abbr": "nehemiah", "actual": "Nehemiah" },
|
|
||||||
{ "abbr": "neh", "actual": "Nehemiah" },
|
|
||||||
{ "abbr": "ne", "actual": "Nehemiah" },
|
|
||||||
{ "abbr": "nehamiah", "actual": "Nehemiah" },
|
|
||||||
{ "abbr": "esther", "actual": "Esther" },
|
|
||||||
{ "abbr": "est", "actual": "Esther" },
|
|
||||||
{ "abbr": "es", "actual": "Esther" },
|
|
||||||
{ "abbr": "esth", "actual": "Esther" },
|
|
||||||
{ "abbr": "job", "actual": "Job" },
|
|
||||||
{ "abbr": "jo", "actual": "Job" },
|
|
||||||
{ "abbr": "jb", "actual": "Job" },
|
|
||||||
{ "abbr": "psalms", "actual": "Psalm" },
|
|
||||||
{ "abbr": "ps", "actual": "Psalm" },
|
|
||||||
{ "abbr": "psa", "actual": "Psalm" },
|
|
||||||
{ "abbr": "psalm", "actual": "Psalm" },
|
|
||||||
{ "abbr": "psm", "actual": "Psalm" },
|
|
||||||
{ "abbr": "proverbs", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "prov", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "pr", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "pro", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "proverb", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "prv", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "prvbs", "actual": "Proverbs" },
|
|
||||||
{ "abbr": "ecclesiastes", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "eccl", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "ecc", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "eccles", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "ec", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "ecl", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "ecclesiaste", "actual": "Ecclesiastes" },
|
|
||||||
{ "abbr": "song of solomon", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "song of songs", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "sos", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "ss", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "son", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "so", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "song", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "songs", "actual": "Song of Solomon" },
|
|
||||||
{ "abbr": "isaiah", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "is", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "isah", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "isai", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "ia", "actual": "Isaiah" },
|
|
||||||
{ "abbr": "jerimiah", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "jeremiah", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "jer", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "je", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "jere", "actual": "Jeremiah" },
|
|
||||||
{ "abbr": "lamentations", "actual": "Lamentations" },
|
|
||||||
{ "abbr": "lam", "actual": "Lamentations" },
|
|
||||||
{ "abbr": "la", "actual": "Lamentations" },
|
|
||||||
{ "abbr": "lamentation", "actual": "Lamentations" },
|
|
||||||
];
|
|
||||||
|
|
||||||
for (let bk of booknames) {
|
|
||||||
it('Get Data for: ' + bk.abbr, () => {
|
|
||||||
let svc: BibleService = getTestBed().get(BibleService);
|
|
||||||
let book = Reference.parseBook(bk.abbr);
|
|
||||||
for (let i = 1; i <= book.lastchapter; i++)
|
|
||||||
{
|
{
|
||||||
let ref = new Reference(bk.abbr + " "+i).Section;
|
let svc: BibleService = getTestBed().get(BibleService);
|
||||||
|
let ref = new Reference(name + " " + i).Section;
|
||||||
var r = svc.getResult(ref);
|
var r = svc.getResult(ref);
|
||||||
|
|
||||||
expect(r.msg).toBe(':)');
|
expect(r.msg).toBe(':)');
|
||||||
expect(r.ref).toBe(book.bookname + " "+i+":1 - *");
|
expect(r.ref).toBe(book.bookname + " " + i + ":1 - *");
|
||||||
expect(r.status).toBe(0);
|
expect(r.status).toBe(0);
|
||||||
expect(r.cs[0].vss.length).toBeGreaterThan(1);
|
expect(r.cs[0].vss.length).toBeGreaterThan(1);
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
57
DynamicBibleIonic/src/strongs-service.spec.ts
Normal file
57
DynamicBibleIonic/src/strongs-service.spec.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import { getTestBed, TestBed } from '@angular/core/testing';
|
||||||
|
import { BaseRequestOptions, HttpModule, Http, } from '@angular/http';
|
||||||
|
import { MockBackend } from '@angular/http/testing';
|
||||||
|
import { StrongsService } from './strongs-service';
|
||||||
|
|
||||||
|
describe('Strongs Service', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [HttpModule],
|
||||||
|
providers: [
|
||||||
|
StrongsService,
|
||||||
|
{
|
||||||
|
provide: Http,
|
||||||
|
useFactory: function (backend, defaultOptions) {
|
||||||
|
return new Http(backend, defaultOptions);
|
||||||
|
},
|
||||||
|
deps: [MockBackend, BaseRequestOptions]
|
||||||
|
},
|
||||||
|
MockBackend,
|
||||||
|
BaseRequestOptions
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should return an error status', () => {
|
||||||
|
let svc: StrongsService = getTestBed().get(StrongsService);
|
||||||
|
let r = svc.getResult(6000, "grk");
|
||||||
|
|
||||||
|
});
|
||||||
|
it('Should get G2396', () => {
|
||||||
|
let svc: StrongsService = getTestBed().get(StrongsService);
|
||||||
|
let r = svc.getResult(2396, "grk");
|
||||||
|
expect(r.msg).toBe(':)');
|
||||||
|
expect(r.status).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let j = 1; j <= 5624; j++) {
|
||||||
|
it('Get G' + j, () => {
|
||||||
|
let svc: StrongsService = getTestBed().get(StrongsService);
|
||||||
|
let r = svc.getResult(j, "grk");
|
||||||
|
|
||||||
|
expect(r.msg).toBe(':)');
|
||||||
|
expect(r.status).toBe(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let j = 1; j <= 8674; j++) {
|
||||||
|
it('Get H' + j, () => {
|
||||||
|
let svc: StrongsService = getTestBed().get(StrongsService);
|
||||||
|
let r = svc.getResult(j, "heb");
|
||||||
|
|
||||||
|
expect(r.msg).toBe(':)');
|
||||||
|
expect(r.status).toBe(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
@ -4,17 +4,14 @@ import { Injectable } from "@angular/core";
|
|||||||
import { Http } from "@angular/http";
|
import { Http } from "@angular/http";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StrongsService
|
export class StrongsService {
|
||||||
{
|
|
||||||
result: StrongsResult;
|
result: StrongsResult;
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
constructor(private http: Http)
|
constructor(private http: Http) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getResult(sn: number, dict: string): StrongsResult
|
getResult(sn: number, dict: string): StrongsResult {
|
||||||
{
|
|
||||||
const self = this;
|
const self = this;
|
||||||
this.result = {
|
this.result = {
|
||||||
prefix: "",
|
prefix: "",
|
||||||
@ -28,19 +25,15 @@ export class StrongsService
|
|||||||
msg: ":)"
|
msg: ":)"
|
||||||
};
|
};
|
||||||
let url = dict + Math.ceil(sn / 100) + ".json";
|
let url = dict + Math.ceil(sn / 100) + ".json";
|
||||||
if (dict === "grk")
|
if (dict === "grk") {
|
||||||
{
|
|
||||||
self.result.prefix = "G";
|
self.result.prefix = "G";
|
||||||
if (sn > 5624 || sn < 1)
|
if (sn > 5624 || sn < 1) {
|
||||||
{
|
|
||||||
self.result.status = -1;
|
self.result.status = -1;
|
||||||
self.result.msg = "Strongs Number G" + sn + " is out of range.";
|
self.result.msg = "Strongs Number G" + sn + " is out of range.";
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
self.result.prefix = "H";
|
self.result.prefix = "H";
|
||||||
if (sn > 8674 || sn < 1)
|
if (sn > 8674 || sn < 1) {
|
||||||
{
|
|
||||||
self.result.status = -1;
|
self.result.status = -1;
|
||||||
self.result.msg = "Strongs Number H" + sn + " is out of range.";
|
self.result.msg = "Strongs Number H" + sn + " is out of range.";
|
||||||
}
|
}
|
||||||
@ -53,14 +46,12 @@ export class StrongsService
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: `data/strongs/${url}`,
|
url: "data/strongs/" + url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: StrongsDefinition[], t, x)
|
success: function (d: StrongsDefinition[], t, x) {
|
||||||
{
|
|
||||||
self.result.strongs = d;
|
self.result.strongs = d;
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error: function (request, status, error) {
|
||||||
{
|
|
||||||
console.log(error);
|
console.log(error);
|
||||||
self.result.status = -1;
|
self.result.status = -1;
|
||||||
self.result.msg = "Unable to retrieve Strongs Data for " + self.result.prefix + self.result.sn;
|
self.result.msg = "Unable to retrieve Strongs Data for " + self.result.prefix + self.result.sn;
|
||||||
@ -76,21 +67,17 @@ export class StrongsService
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: `data/strongscr/cr${url}`,
|
url: "data/strongscr/cr" + url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: StrongsCrossReference[], t, x)
|
success: function (d: StrongsCrossReference[], t, x) {
|
||||||
{
|
for (let cr of d) {
|
||||||
for (let cr of d)
|
if (cr.id.toUpperCase() == self.result.prefix + self.result.sn) {
|
||||||
{
|
|
||||||
if (cr.id.toUpperCase() == self.result.prefix + self.result.sn)
|
|
||||||
{
|
|
||||||
self.result.crossrefs = cr;
|
self.result.crossrefs = cr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error: function (request, status, error) {
|
||||||
{
|
|
||||||
console.log(error);
|
console.log(error);
|
||||||
self.result.status = -1;
|
self.result.status = -1;
|
||||||
self.result.msg = "Unable to retrieve Strongs Cross References for " + self.result.prefix + self.result.sn;
|
self.result.msg = "Unable to retrieve Strongs Cross References for " + self.result.prefix + self.result.sn;
|
||||||
@ -100,9 +87,8 @@ export class StrongsService
|
|||||||
if (self.result.status === -1)
|
if (self.result.status === -1)
|
||||||
return self.result;
|
return self.result;
|
||||||
|
|
||||||
if (dict === "grk")
|
if (dict === "grk") {
|
||||||
{
|
url = "data/rmac/rs" + (Math.ceil(sn / 1000)) + ".json";
|
||||||
url = `data/rmac/rs${Math.ceil(sn / 1000)}.json`;
|
|
||||||
let rmac_cross_references: RMACCrossReference[];
|
let rmac_cross_references: RMACCrossReference[];
|
||||||
|
|
||||||
// rmac is a two get process.
|
// rmac is a two get process.
|
||||||
@ -111,39 +97,36 @@ export class StrongsService
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: RMACCrossReference[], t, x)
|
success: function (d: RMACCrossReference[], t, x) {
|
||||||
{
|
|
||||||
rmac_cross_references = d;
|
rmac_cross_references = d;
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error: function (request, status, error) {
|
||||||
{
|
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// deal with RMAC
|
// deal with RMAC
|
||||||
this.result.rmaccode = $.grep<RMACCrossReference>(rmac_cross_references, (el, i) => { if (el.i == sn + "") { return true; } else { return false; } })[0].r;
|
let tmp = $.grep<RMACCrossReference>(rmac_cross_references, (el, i) => { if (el.i == sn + "") { return true; } else { return false; } });
|
||||||
if (this.result.rmaccode != undefined)
|
if (tmp.length == 0)
|
||||||
{
|
return this.result;
|
||||||
|
|
||||||
|
this.result.rmaccode = tmp[0].r;
|
||||||
|
if (this.result.rmaccode != undefined) {
|
||||||
url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`;
|
url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (d: RMACDefinition[], t, x)
|
success: function (d: RMACDefinition[], t, x) {
|
||||||
{
|
for (let rmac of d) {
|
||||||
for (let rmac of d)
|
if (rmac.id.toLowerCase() == self.result.rmaccode) {
|
||||||
{
|
|
||||||
if (rmac.id.toLowerCase() == self.result.rmaccode)
|
|
||||||
{
|
|
||||||
self.result.rmac = rmac;
|
self.result.rmac = rmac;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (request, status, error)
|
error: function (request, status, error) {
|
||||||
{
|
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -34,7 +34,8 @@ export class WordService
|
|||||||
results.unshift(this.getSearchReferences("data/index/" + words[w] + "idx.json", q));
|
results.unshift(this.getSearchReferences("data/index/" + words[w] + "idx.json", q));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (q <= words[w] && q > words[w - 1])
|
if (q <= words[w] && q > words[w - 1])
|
||||||
{
|
{
|
||||||
@ -375,16 +376,15 @@ export class WordService
|
|||||||
{
|
{
|
||||||
let r = refs[i].split(":");
|
let r = refs[i].split(":");
|
||||||
// convert references to single integers.
|
// convert references to single integers.
|
||||||
// Book * 100000, Chapter * 1000, Verse remains same, add all together.
|
// Book * 100000000, Chapter * 10000, Verse remains same, add all together.
|
||||||
let ref = r[0] * 100000000;
|
let ref = r[0] * 100000000;
|
||||||
ref = ref + (r[1] * 10000);
|
ref = ref + (r[1] * 10000);
|
||||||
ref = ref + r[2] * 1;
|
ref = ref + r[2] * 1;
|
||||||
results[j][i] = ref;
|
results[j][i] = ref;
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the first result
|
// get the first result
|
||||||
@ -392,9 +392,7 @@ export class WordService
|
|||||||
|
|
||||||
// for each additional result, get the shared set
|
// for each additional result, get the shared set
|
||||||
for (let i = 1; i < results.length; i++)
|
for (let i = 1; i < results.length; i++)
|
||||||
{
|
|
||||||
result = this.returnSharedSet(results[i], result);
|
result = this.returnSharedSet(results[i], result);
|
||||||
}
|
|
||||||
|
|
||||||
// convert the references back into book, chapter and verse.
|
// convert the references back into book, chapter and verse.
|
||||||
for (let i = 0; i < result.length; i++)
|
for (let i = 0; i < result.length; i++)
|
||||||
@ -424,29 +422,23 @@ export class WordService
|
|||||||
while (i < t)
|
while (i < t)
|
||||||
{
|
{
|
||||||
if (x[i] == y[i])
|
if (x[i] == y[i])
|
||||||
{
|
|
||||||
i++;
|
i++;
|
||||||
}
|
|
||||||
if (x[i] < y[i])
|
if (x[i] < y[i])
|
||||||
{
|
|
||||||
x.splice(i, 1);
|
x.splice(i, 1);
|
||||||
}
|
|
||||||
if (x[i] > y[i])
|
if (x[i] > y[i])
|
||||||
{
|
|
||||||
y.splice(i, 1);
|
y.splice(i, 1);
|
||||||
}
|
|
||||||
t = (x.length < y.length) ? x.length : y.length;
|
t = (x.length < y.length) ? x.length : y.length;
|
||||||
// we have to make sure to remove any extra values
|
// we have to make sure to remove any extra values
|
||||||
// at the end of an array when we reach the end of
|
// at the end of an array when we reach the end of
|
||||||
// the other.
|
// the other.
|
||||||
if (t == i && t < x.length)
|
if (t == i && t < x.length)
|
||||||
{
|
|
||||||
x.splice(i, x.length - i);
|
x.splice(i, x.length - i);
|
||||||
}
|
|
||||||
if (t == i && t < y.length)
|
if (t == i && t < y.length)
|
||||||
{
|
|
||||||
y.splice(i, x.length - i);
|
y.splice(i, x.length - i);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// we could return y, because at this time, both arrays
|
// we could return y, because at this time, both arrays
|
||||||
// are identical.
|
// are identical.
|
||||||
|
1
DynamicBibleIonic/www/data/strongs/grk57.json
Normal file
1
DynamicBibleIonic/www/data/strongs/grk57.json
Normal file
File diff suppressed because one or more lines are too long
1
DynamicBibleIonic/www/data/strongs/heb87.json
Normal file
1
DynamicBibleIonic/www/data/strongs/heb87.json
Normal file
File diff suppressed because one or more lines are too long
@ -163,7 +163,7 @@
|
|||||||
</site>
|
</site>
|
||||||
<site name="DynamicBibleApp" id="2">
|
<site name="DynamicBibleApp" id="2">
|
||||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||||
<virtualDirectory path="/" physicalPath="C:\Projects\dynamicbible\DynamicBibleUtility\DynamicBibleApp" />
|
<virtualDirectory path="/" physicalPath="E:\Documents\Visual Studio 2010\Projects\dynamicbible\DynamicBibleUtility\DynamicBibleApp" />
|
||||||
</application>
|
</application>
|
||||||
<bindings>
|
<bindings>
|
||||||
<binding protocol="http" bindingInformation="*:35099:localhost" />
|
<binding protocol="http" bindingInformation="*:35099:localhost" />
|
||||||
|
@ -47,7 +47,7 @@ namespace DynamicBibleUtility
|
|||||||
if (!_words.Contains(s))
|
if (!_words.Contains(s))
|
||||||
{
|
{
|
||||||
_words.Add(s);
|
_words.Add(s);
|
||||||
var i = new IndexItem {word = s};
|
var i = new IndexItem { word = s };
|
||||||
i.refs.Add(bk + ":" + ch + ":" + vs);
|
i.refs.Add(bk + ":" + ch + ":" + vs);
|
||||||
_idx.Add(i);
|
_idx.Add(i);
|
||||||
}
|
}
|
||||||
@ -262,17 +262,17 @@ namespace DynamicBibleUtility
|
|||||||
var el = (XElement)n;
|
var el = (XElement)n;
|
||||||
if (el.Name != "BIBLEBOOK") continue;
|
if (el.Name != "BIBLEBOOK") continue;
|
||||||
|
|
||||||
var bk = new Book {bk = Convert.ToInt32(el.FirstAttribute.Value)};
|
var bk = new Book { bk = Convert.ToInt32(el.FirstAttribute.Value) };
|
||||||
foreach (XElement chn in el.Nodes())
|
foreach (XElement chn in el.Nodes())
|
||||||
{
|
{
|
||||||
var ch = new Chapter {ch = Convert.ToInt32(chn.FirstAttribute.Value)};
|
var ch = new Chapter { ch = Convert.ToInt32(chn.FirstAttribute.Value) };
|
||||||
foreach (XElement vs in chn.Nodes())
|
foreach (XElement vs in chn.Nodes())
|
||||||
{
|
{
|
||||||
var v = new Verse {v = Convert.ToInt32(vs.FirstAttribute.Value)};
|
var v = new Verse { v = Convert.ToInt32(vs.FirstAttribute.Value) };
|
||||||
foreach (XNode o in vs.Nodes())
|
foreach (XNode o in vs.Nodes())
|
||||||
{
|
{
|
||||||
v.w.AddRange(ProcessText(o));
|
v.w.AddRange(ProcessText(o));
|
||||||
if (v.w.Count > 1 &&
|
if (v.w.Count > 1 &&
|
||||||
(
|
(
|
||||||
v.w.Last().t.StartsWith("?")
|
v.w.Last().t.StartsWith("?")
|
||||||
|| v.w.Last().t.StartsWith(";")
|
|| v.w.Last().t.StartsWith(";")
|
||||||
@ -330,7 +330,7 @@ namespace DynamicBibleUtility
|
|||||||
else if (o.GetType() == typeof(XText))
|
else if (o.GetType() == typeof(XText))
|
||||||
{
|
{
|
||||||
var t = ((XText)o).Value.Trim();
|
var t = ((XText)o).Value.Trim();
|
||||||
|
|
||||||
Ts.Add(new Text(t));
|
Ts.Add(new Text(t));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -494,26 +494,52 @@ namespace DynamicBibleUtility
|
|||||||
foreach (var f in ofd.FileNames)
|
foreach (var f in ofd.FileNames)
|
||||||
{
|
{
|
||||||
var doc = VAE.Common.Serialization.JSON.Deserialize(System.IO.File.ReadAllText(f), typeof(SDict)) as SDict;
|
var doc = VAE.Common.Serialization.JSON.Deserialize(System.IO.File.ReadAllText(f), typeof(SDict)) as SDict;
|
||||||
|
var dict = doc.Entries.ToDictionary(k => k.Key, v => v.Value);
|
||||||
|
|
||||||
foreach (var pair in doc.Entries)
|
foreach (var pair in master_dict)
|
||||||
{
|
{
|
||||||
pair.Value.i = pair.Key;
|
|
||||||
pair.Value.n = Convert.ToInt32(pair.Key.Substring(1));
|
pair.Value.n = Convert.ToInt32(pair.Key.Substring(1));
|
||||||
if (master_dict.ContainsKey(pair.Key))
|
if (dict.ContainsKey(pair.Key))
|
||||||
{
|
{
|
||||||
pair.Value.de = master_dict[pair.Key].de;
|
pair.Value.lemma = dict[pair.Key].lemma;
|
||||||
pair.Value.tr = master_dict[pair.Key].tr;
|
|
||||||
pair.Value.p = master_dict[pair.Key].p;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var lst = doc.Entries.Select(o => o.Value).OrderBy(o => o.n);
|
var lst_heb = master_dict.Values.Where(o => o.i.StartsWith("H")).OrderBy(o => o.n);
|
||||||
|
var lst_grk = master_dict.Values.Where(o => o.i.StartsWith("G")).OrderBy(o => o.n);
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
foreach(var s in lst_grk)
|
||||||
|
{
|
||||||
|
if (s.n != i)
|
||||||
|
{
|
||||||
|
UpdateStatus(s.i + ":" + i+"\r\n");
|
||||||
|
i = s.n;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
i = 1;
|
||||||
|
foreach (var s in lst_heb)
|
||||||
|
{
|
||||||
|
if (s.n != i)
|
||||||
|
{
|
||||||
|
UpdateStatus(s.i + ":" + i + "\r\n");
|
||||||
|
i = s.n;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var lsts = new List<IEnumerable<StrongDictEntry>> { lst_grk, lst_heb };
|
||||||
|
foreach (var lst in lsts)
|
||||||
|
{
|
||||||
var last = 0;
|
var last = 0;
|
||||||
var temp = new List<StrongDictEntry>();
|
var temp = new List<StrongDictEntry>();
|
||||||
|
var c = 0;
|
||||||
foreach (var e in lst)
|
foreach (var e in lst)
|
||||||
{
|
{
|
||||||
var c = e.n;
|
c = e.n;
|
||||||
temp.Add(e);
|
temp.Add(e);
|
||||||
if ((c / 100) > last)
|
if ((c / 100) > last)
|
||||||
{
|
{
|
||||||
@ -524,6 +550,13 @@ namespace DynamicBibleUtility
|
|||||||
UpdateStatus("Set: " + last + "\r\n");
|
UpdateStatus("Set: " + last + "\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle the last set.
|
||||||
|
last = (temp.Last().n / 100)+1;
|
||||||
|
System.IO.File.WriteAllText((temp.First().i.Contains("H") ? "heb" : "grk") + last + ".json", VAE.Common.Serialization.JSON.Serialize(temp));
|
||||||
|
temp = new List<StrongDictEntry>();
|
||||||
|
|
||||||
|
UpdateStatus("Set: " + last + "\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -560,7 +593,7 @@ namespace DynamicBibleUtility
|
|||||||
rmacs.Add(r);
|
rmacs.Add(r);
|
||||||
r.id = el.FirstAttribute.Value;
|
r.id = el.FirstAttribute.Value;
|
||||||
r.d = new List<string>();
|
r.d = new List<string>();
|
||||||
foreach(XElement d in el.Nodes())
|
foreach (XElement d in el.Nodes())
|
||||||
{
|
{
|
||||||
r.d.Add(d.Value);
|
r.d.Add(d.Value);
|
||||||
}
|
}
|
||||||
@ -569,9 +602,8 @@ namespace DynamicBibleUtility
|
|||||||
}
|
}
|
||||||
var name = f.Substring(f.LastIndexOf("\\") + 1);
|
var name = f.Substring(f.LastIndexOf("\\") + 1);
|
||||||
name = name.Substring(0, name.IndexOf("."));
|
name = name.Substring(0, name.IndexOf("."));
|
||||||
System.IO.File.WriteAllText(name+ ".json", VAE.Common.Serialization.JSON.Serialize(rmacs));
|
System.IO.File.WriteAllText(name + ".json", VAE.Common.Serialization.JSON.Serialize(rmacs));
|
||||||
UpdateStatus("Set: " + f + "\r\n");
|
UpdateStatus("Set: " + f + "\r\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -615,7 +647,6 @@ namespace DynamicBibleUtility
|
|||||||
name = name.Substring(0, name.IndexOf("."));
|
name = name.Substring(0, name.IndexOf("."));
|
||||||
System.IO.File.WriteAllText(name + ".json", VAE.Common.Serialization.JSON.Serialize(rmacs));
|
System.IO.File.WriteAllText(name + ".json", VAE.Common.Serialization.JSON.Serialize(rmacs));
|
||||||
UpdateStatus("Set: " + f + "\r\n");
|
UpdateStatus("Set: " + f + "\r\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user