-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #668 from unfoldingWord/merge-release-v2.4.1
Merge release v2.4.1
- Loading branch information
Showing
5 changed files
with
121 additions
and
19 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* eslint-env jest */ | ||
import * as Languages from '../languages'; | ||
|
||
describe('Test Languages',()=>{ | ||
const minimumLangCount = 9000; | ||
|
||
test('getLanguage() should work with mixed and lower case', () => { | ||
const codes = ['sr-latn', 'sr-Latn', 'SR-LATN', 'ur-deva', 'ur-Deva', 'UR-DEVA', 'ZH']; | ||
|
||
for (let languageId of codes) { | ||
const languageData = Languages.getLanguage({languageId}); | ||
expect(languageData).toBeTruthy(); | ||
expect(languageData.languageId.toLowerCase()).toEqual(languageId.toLowerCase()); | ||
} | ||
}); | ||
|
||
test('getLanguages() should work', () => { | ||
const languages = Languages.getLanguages(); | ||
const langCount = languages.length; | ||
expect(langCount).toBeLessThan(minimumLangCount * 1.2); | ||
|
||
// make sure fields are valid and in sequence | ||
for (let i = 1; i < langCount; i++) { | ||
const lang = languages[i - 1]; | ||
expect(lang.languageId.length).toBeGreaterThan(0); | ||
const languageName = lang.languageName || lang.localized | ||
if (!languageName.length) { | ||
console.log(`invalid languageName ${languageName} for languageId ${lang.languageId}`) | ||
} | ||
expect(lang.localized.length).toBeGreaterThan(0); | ||
if (!lang.localized.length) { | ||
console.log(`invalid localized ${lang.localized} for languageId ${lang.languageId}`) | ||
} | ||
expect(lang.localized.length).toBeGreaterThan(0); | ||
const directionValid = lang.direction === 'ltr' || lang.direction === 'rtl' | ||
if (!lang.localized.length) { | ||
console.log(`invalid direction ${lang.direction} for languageId ${lang.languageId}`) | ||
} | ||
expect(directionValid).toBeTruthy(); | ||
} | ||
}); | ||
|
||
test('getLanguages() verify no dupes among language codes.', () => { | ||
let languages = Languages.getLanguages(); | ||
let localLanguageCodes = languages.map(language => language.languageId); | ||
|
||
const sorted = localLanguageCodes.sort(); | ||
let dupsFound = 0; | ||
|
||
for ( let idx = 1; idx < sorted.length; idx++ ) { | ||
if ( sorted[idx] == sorted[idx-1]) { | ||
dupsFound++; | ||
} | ||
} | ||
|
||
expect(dupsFound).toBeLessThan(1); | ||
expect(sorted.length).toBeGreaterThan(minimumLangCount); | ||
}); | ||
|
||
test('getGatewayLanguages() verify no dupes among language codes.', async () => { | ||
let languages = await Languages.getGatewayLanguages(); | ||
let localLanguageCodes = languages.map(language => language.languageId); | ||
|
||
const sorted = localLanguageCodes.sort(); | ||
let dupsFound = 0; | ||
|
||
for ( let idx = 1; idx < sorted.length; idx++ ) { | ||
if ( sorted[idx] == sorted[idx-1]) { | ||
dupsFound++; | ||
} | ||
} | ||
|
||
expect(dupsFound).toBeLessThan(1); | ||
const minimumGwLangs = 40; | ||
const maximumGwLangs = 100; | ||
expect(sorted.length).toBeGreaterThan(minimumGwLangs); | ||
expect(sorted.length).not.toBeGreaterThan(maximumGwLangs); | ||
}); | ||
|
||
describe('getLanguage()',()=>{ | ||
test('Nepali ne should succeed', () => { | ||
const code = 'ne'; | ||
const name = 'Nepali'; | ||
let foundLanguage = Languages.getLanguage({ languageId: code }); | ||
|
||
expect(foundLanguage.languageName).toEqual(name); | ||
expect(foundLanguage.languageId).toEqual(code); | ||
}); | ||
|
||
test('Nepali npi should succeed', () => { | ||
const code = 'npi'; | ||
const name = 'Nepali'; | ||
let foundLanguage = Languages.getLanguage({ languageId: code }); | ||
|
||
expect(foundLanguage.languageName).toEqual(name); | ||
expect(foundLanguage.languageId).toEqual(code); | ||
}); | ||
}); | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9425,10 +9425,10 @@ schema-utils@^3.0.0: | |
ajv "^6.12.5" | ||
ajv-keywords "^3.5.2" | ||
|
||
[email protected].12: | ||
version "5.5.12" | ||
resolved "https://registry.yarnpkg.com/scripture-resources-rcl/-/scripture-resources-rcl-5.5.12.tgz#789c89ec02ba5cd94c6688d4cc5cccfcee58a81d" | ||
integrity sha512-/+0cTeU/gWUNTDqmM0/gZIf4T2h1mj3FE8whdYbITT9N4F7pQhmugHZmS25lbJVw99LGf00g+nH3Wi5UsPTY2w== | ||
[email protected].13: | ||
version "5.5.13" | ||
resolved "https://registry.yarnpkg.com/scripture-resources-rcl/-/scripture-resources-rcl-5.5.13.tgz#48313f0923f62c8656b0463bfb796c720761a331" | ||
integrity sha512-lCmwDWOsFC/gf02YINm18hrYnb5H47AoStrpY8DBd6PVTywSW3khjwO8IkbguCQHmZOVciRiUt29E26Xx1UQFg== | ||
dependencies: | ||
bible-reference-range "^1.1.0" | ||
deep-freeze "^0.0.1" | ||
|
@@ -9442,7 +9442,7 @@ [email protected]: | |
string-punctuation-tokenizer "^2.2.0" | ||
tc-ui-toolkit "^5.3.3" | ||
use-deep-compare-effect "^1.3.1" | ||
usfm-js "^3.4.2" | ||
usfm-js "^3.4.3" | ||
uw-quote-helpers "1.1.4" | ||
word-aligner "^1.0.0" | ||
xregexp "^4.1.1" | ||
|
@@ -10783,10 +10783,10 @@ use@^3.1.0: | |
resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" | ||
integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== | ||
|
||
[email protected].2, usfm-js@^3.4.2: | ||
version "3.4.2" | ||
resolved "https://registry.yarnpkg.com/usfm-js/-/usfm-js-3.4.2.tgz#a4232cffe38c9f521246b007a4045648cbcf419a" | ||
integrity sha512-i5nGxGwFhkOWd7xgfVWQ6GTkCpksfy5AUIwNJcwanTn3ua5J1nwl3pjApCDA6x1B++8ICkcQMUt0FB/bkKdE2g== | ||
[email protected].3, usfm-js@^3.4.3: | ||
version "3.4.3" | ||
resolved "https://registry.yarnpkg.com/usfm-js/-/usfm-js-3.4.3.tgz#dffa5a00cdbf7c02df89f6e876136df6aa532361" | ||
integrity sha512-c5d2dzmSnEfFSPfMXnnycIPwdw8ryBsb2r2CUEwiXpsUMm+gDmhFz5GGOufYP5rGGVwAssHdSM8oOkcaHz+Hwg== | ||
dependencies: | ||
lodash.clonedeep "^4.5.0" | ||
|
||
|
@@ -11101,17 +11101,17 @@ which@^2.0.1: | |
dependencies: | ||
isexe "^2.0.0" | ||
|
||
[email protected].2: | ||
version "1.1.2" | ||
resolved "https://registry.yarnpkg.com/word-aligner-rcl/-/word-aligner-rcl-1.1.2.tgz#6bda84e580be9a58cc24f96892743a35c53b4713" | ||
integrity sha512-2GGIFmMpBY8lpidSwC7MTXkZOl/xNomI9ixCOPIRaVPXASlUNM/+GPIR23D5CgqirXqGXs/4ZUhs+y9RihaInw== | ||
[email protected].3: | ||
version "1.1.3" | ||
resolved "https://registry.yarnpkg.com/word-aligner-rcl/-/word-aligner-rcl-1.1.3.tgz#4d24a102b13f6770086cb042c1c90c825d93edb8" | ||
integrity sha512-glVSJ75rX254R+0vLjhyZQ51ns8QBb4YKgYd46yTjpUXASlPRcykOQKzVXdOFeE2fEz6t6Gu1nKWrDL+EvwUsw== | ||
dependencies: | ||
bible-reference-range "^1.1.0" | ||
deep-equal "^2.0.5" | ||
file-loader "^6.2.0" | ||
lodash.clonedeep "^4.5.0" | ||
string-punctuation-tokenizer "2.2.0" | ||
usfm-js "3.4.2" | ||
usfm-js "3.4.3" | ||
word-aligner "1.0.2" | ||
wordmap-lexer "^0.3.6" | ||
|
||
|