|
1 | 1 | import { Canon } from './canon'; |
2 | 2 |
|
3 | 3 | describe('Canon', () => { |
| 4 | + describe('isBookNT()', () => { |
| 5 | + it("should return whether it's NT or not", () => { |
| 6 | + let isBookNT = Canon.isBookNT(1); |
| 7 | + expect(isBookNT).toBe(false); |
| 8 | + isBookNT = Canon.isBookNT('GEN'); |
| 9 | + expect(isBookNT).toBe(false); |
| 10 | + isBookNT = Canon.isBookNT(42); |
| 11 | + expect(isBookNT).toBe(true); |
| 12 | + isBookNT = Canon.isBookNT('MAT'); |
| 13 | + expect(isBookNT).toBe(true); |
| 14 | + }); |
| 15 | + }); |
| 16 | + |
| 17 | + describe('isBookOT()', () => { |
| 18 | + it("should return whether it's OT or not", () => { |
| 19 | + let isBookOT = Canon.isBookOT(1); |
| 20 | + expect(isBookOT).toBe(true); |
| 21 | + isBookOT = Canon.isBookOT('GEN'); |
| 22 | + expect(isBookOT).toBe(true); |
| 23 | + isBookOT = Canon.isBookOT(42); |
| 24 | + expect(isBookOT).toBe(false); |
| 25 | + isBookOT = Canon.isBookOT('MAT'); |
| 26 | + expect(isBookOT).toBe(false); |
| 27 | + }); |
| 28 | + }); |
| 29 | + |
| 30 | + describe('isBookDC()', () => { |
| 31 | + it("should return whether it's Deutero Canon or not", () => { |
| 32 | + let isBookDC = Canon.isBookDC(66); |
| 33 | + expect(isBookDC).toBe(false); |
| 34 | + isBookDC = Canon.isBookDC('REV'); |
| 35 | + expect(isBookDC).toBe(false); |
| 36 | + isBookDC = Canon.isBookDC(67); |
| 37 | + expect(isBookDC).toBe(true); |
| 38 | + isBookDC = Canon.isBookDC('TOB'); |
| 39 | + expect(isBookDC).toBe(true); |
| 40 | + }); |
| 41 | + }); |
| 42 | + |
| 43 | + describe('allBookNumbers()', () => { |
| 44 | + it('should yield each book number', () => { |
| 45 | + const iterator = Canon.allBookNumbers(); |
| 46 | + expect(iterator.next().value).toEqual(1); |
| 47 | + expect(iterator.next().value).toEqual(2); |
| 48 | + expect(iterator.next().value).toEqual(3); |
| 49 | + }); |
| 50 | + }); |
| 51 | + |
| 52 | + describe('extraBooks()', () => { |
| 53 | + it('should return array of extra book IDs', () => { |
| 54 | + const extraBooks = Canon.extraBooks(); |
| 55 | + expect(extraBooks[0]).toEqual('XXA'); |
| 56 | + expect(extraBooks.length).toEqual(7); |
| 57 | + }); |
| 58 | + }); |
| 59 | + |
4 | 60 | describe('bookNumberToId()', () => { |
5 | 61 | it('should return bookId', () => { |
6 | 62 | const bookId = Canon.bookNumberToId(1); |
@@ -32,6 +88,29 @@ describe('Canon', () => { |
32 | 88 | }); |
33 | 89 | }); |
34 | 90 |
|
| 91 | + describe('isCanonical()', () => { |
| 92 | + it("should return whether it's canonical or not", () => { |
| 93 | + // `num` overload is tested in `isBookDC()`. |
| 94 | + let isCanonical = Canon.isCanonical('GEN'); |
| 95 | + expect(isCanonical).toBe(true); |
| 96 | + isCanonical = Canon.isCanonical('XXA'); |
| 97 | + expect(isCanonical).toBe(false); |
| 98 | + }); |
| 99 | + }); |
| 100 | + |
| 101 | + describe('isExtraMaterial()', () => { |
| 102 | + it("should return whether it's extra material or not", () => { |
| 103 | + let isExtraMaterial = Canon.isExtraMaterial(1); |
| 104 | + expect(isExtraMaterial).toBe(false); |
| 105 | + isExtraMaterial = Canon.isExtraMaterial('GEN'); |
| 106 | + expect(isExtraMaterial).toBe(false); |
| 107 | + isExtraMaterial = Canon.isExtraMaterial(93); |
| 108 | + expect(isExtraMaterial).toBe(true); |
| 109 | + isExtraMaterial = Canon.isExtraMaterial('XXA'); |
| 110 | + expect(isExtraMaterial).toBe(true); |
| 111 | + }); |
| 112 | + }); |
| 113 | + |
35 | 114 | describe('isObsolete()', () => { |
36 | 115 | it("should return whether it's obsolete or not", () => { |
37 | 116 | let isObsolete = Canon.isObsolete(1); |
|
0 commit comments