mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-01 16:33:38 -04:00
Working on test.
This commit is contained in:
parent
aa0778507a
commit
dbc37b177a
2 changed files with 5 additions and 5 deletions
|
@ -46,7 +46,7 @@ toHex = (n) ->
|
||||||
h = '0'+h if h.length is 1
|
h = '0'+h if h.length is 1
|
||||||
h
|
h
|
||||||
|
|
||||||
i18n = (say, target, language=me.lang(), fallback='en') ->
|
module.exports.i18n = (say, target, language=me.lang(), fallback='en') ->
|
||||||
generalResult = null
|
generalResult = null
|
||||||
fallbackResult = null
|
fallbackResult = null
|
||||||
fallforwardResult = null # If a general language isn't available, the first specific one will do
|
fallforwardResult = null # If a general language isn't available, the first specific one will do
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
describe 'utils library', ->
|
describe 'utils library', ->
|
||||||
require 'lib/utils'
|
util = require 'lib/utils'
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
fixture1 = {
|
this.fixture1 = {
|
||||||
"text": "G'day, Wizard! Come to practice? Well, let's get started...",
|
"text": "G'day, Wizard! Come to practice? Well, let's get started...",
|
||||||
"i18n": {
|
"i18n": {
|
||||||
"es-419": {
|
"es-419": {
|
||||||
|
@ -29,7 +29,7 @@ describe 'utils library', ->
|
||||||
"sv": {
|
"sv": {
|
||||||
"text": "Godagens, trollkarl! Kommit för att öva? Nå, låt oss börja..."
|
"text": "Godagens, trollkarl! Kommit för att öva? Nå, låt oss börja..."
|
||||||
},
|
},
|
||||||
"en": {
|
"ex": {
|
||||||
"text": "Ohai Magician!"
|
"text": "Ohai Magician!"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -40,4 +40,4 @@ describe 'utils library', ->
|
||||||
}
|
}
|
||||||
|
|
||||||
it 'i18n should find a valid target string', ->
|
it 'i18n should find a valid target string', ->
|
||||||
expect(i18n(fixture1, 'text', 'en')).toEqual(fixture1.i18n.en.text)
|
expect(util.i18n(this.fixture1, 'text', 'sv')).toEqual(this.fixture1.i18n.en.text)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue