-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
605 additions
and
254 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
testonly: false | ||
with-expecter: true | ||
# inpackage: true | ||
# dir: mocks/{{ replaceAll .InterfaceDirRelative "internal" "internal_" }} | ||
# mockname: "{{.InterfaceName}}" | ||
# outpkg: "{{.PackageName}}" | ||
filename: "{{.InterfaceName}}.go" | ||
all: true | ||
packages: | ||
github.com/trezorg/lingualeo/pkg/translator: | ||
config: | ||
recursive: true | ||
with-expecter: true | ||
mockname: "Mock_{{.InterfaceName}}" | ||
# outpkg: mocks | ||
dir: ./{{ replaceAll .InterfaceDirRelative "internal" "internal_" }} | ||
filename: "mock_{{.InterfaceName}}.go" | ||
inpackage: true |
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
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 was deleted.
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package fakeapi | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/trezorg/lingualeo/pkg/api" | ||
) | ||
|
||
var ( | ||
SoundURL = "http://audiocdn.lingualeo.com/v2/3/102085-631152000.mp3" | ||
ResponseData = []byte(`{"error_msg":"","translate_source":"base","is_user":0, | ||
"word_forms":[{"word":"accommodation","type":"прил."}], | ||
"pic_url":"http:\/\/contentcdn.lingualeo.com\/uploads\/picture\/3589594.png", | ||
"translate":[ | ||
{"id":2569250,"value":"жильё","votes":5703,"is_user":0,"pic_url":"http:\/\/contentcdn.lingualeo.com\/uploads\/picture\/31064.png"}, | ||
{"id":2718711,"value":"проживание","votes":1589,"is_user":0,"pic_url":"http:\/\/contentcdn.lingualeo.com\/uploads\/picture\/335521.png"}, | ||
{"id":185932,"value":"размещение","votes":880,"is_user":0,"pic_url":"http:\/\/contentcdn.lingualeo.com\/uploads\/picture\/374830.png"}, | ||
{"id":2735899,"value":"помещение","votes":268,"is_user":0,"pic_url":"http:\/\/contentcdn.lingualeo.com\/uploads\/picture\/620779.png"} | ||
], | ||
"transcription":"əkəədˈeɪːʃən","word_id":102085,"word_top":0, | ||
"sound_url":"http:\/\/audiocdn.lingualeo.com\/v2\/3\/102085-631152000.mp3"}`) | ||
Expected = []string{"жильё", "проживание", "размещение", "помещение"} | ||
SearchWord = "accommodation" | ||
) | ||
|
||
func CheckResult(t *testing.T, res api.Result, searchWord string, expected []string) { | ||
assert.Equalf(t, res.Word, searchWord, "Incorrect search word: %s", searchWord) | ||
assert.Len(t, res.Words, 4, "Incorrect number of translated words: %d. Expected: %d", len(res.Words), len(expected)) | ||
assert.Equalf(t, res.Words, expected, "Incorrect translated words order: %s. Expected: %s", | ||
strings.Join(expected, ", "), | ||
strings.Join(res.Words, ", "), | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.