mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-11 12:44:22 +08:00
Transformer error on empty list
This commit is contained in:
@@ -2,13 +2,15 @@ angular.module("sideBySide").factory("transformer", () ->
|
||||
# Transform translations
|
||||
#
|
||||
# @param translations [...Object] Translation with 'meta' and 'content' keys
|
||||
# @throw On uneven number of verses
|
||||
# @throw No poems or uneven number of verses
|
||||
# @return [Array] Translations transformed into row-based format
|
||||
return (translations...) ->
|
||||
# Check whether all translations have same number of verses
|
||||
#
|
||||
# @param translations [array] Translations to check
|
||||
check_lengths = (translations) ->
|
||||
if translations.length < 1
|
||||
throw "No poems found!"
|
||||
lengths = []
|
||||
for translation in translations
|
||||
l = translation.content.length
|
||||
|
||||
@@ -103,7 +103,11 @@ test("transformer", () ->
|
||||
)
|
||||
deepEqual(transformer(english, czech), expected)
|
||||
|
||||
# Test various error messages as we remove items
|
||||
# Test various error messages
|
||||
throws(() ->
|
||||
transformer()
|
||||
)
|
||||
|
||||
czech.content.pop()
|
||||
throws(() ->
|
||||
transformer(english, czech, polish)
|
||||
|
||||
Reference in New Issue
Block a user