Skip to content

Commit

Permalink
Fixes GetBible chapter references #4
Browse files Browse the repository at this point in the history
Still need to fix chapter ranges
  • Loading branch information
joshpetit committed Jan 6, 2021
1 parent 030fee4 commit 815f30d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/src/api/GetBible.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,17 @@ class GetBible extends BibleProvider {
var extra = json;
var ref = query.reference;
var jVersion = json['version'].toUpperCase();
var book = json['book'][0];
var book = json['book'];
if (book != null) {
book = book[0];
} else {
var encoder = new JsonEncoder.withIndent(" ");
//print(encoder.convert(json['chapter']));
book = json;
}
var chapter = book['chapter'];
//print(chapter);
if (chapter == null) {}
var verses = <String, String>{};
var passage = StringBuffer();
chapter.keys.forEach((x) => {
Expand Down
6 changes: 4 additions & 2 deletions test/provider_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ void main() {
});

test('Getbible', () async {
var passage = await bible.queryPassage('Genesis 1:1-4',
var passage = await bible.queryPassage('Genesis 1',
version: 'asv', providerName: 'getbible');
expect(passage.verses.length, equals(31));
passage = await bible.queryPassage('Genesis 1:1-4',
version: 'asv', providerName: 'getbible');

expect(passage.verses.length, equals(4));
expect(passage.extra, isNot(null));
expect(passage.version, equals('ASV'));
Expand Down

0 comments on commit 815f30d

Please sign in to comment.