@@ -29,55 +29,71 @@ const toLang = `ru`;
29
29
30
30
test . before ( tools . checkCredentials ) ;
31
31
32
- test ( `should detect language of a single string` , async ( t ) => {
32
+ test ( `should detect language of a single string` , async t => {
33
33
const output = await tools . runAsync ( `${ cmd } detect "${ text } "` , cwd ) ;
34
34
const [ detection ] = await translate . detect ( text ) ;
35
35
const expected = `Detections:\n${ text } => ${ detection . language } ` ;
36
36
t . is ( output , expected ) ;
37
37
} ) ;
38
38
39
- test ( `should detect language of multiple strings` , async ( t ) => {
40
- const output = await tools . runAsync ( `${ cmd } detect "${ text } " "${ text2 } "` , cwd ) ;
39
+ test ( `should detect language of multiple strings` , async t => {
40
+ const output = await tools . runAsync (
41
+ `${ cmd } detect "${ text } " "${ text2 } "` ,
42
+ cwd
43
+ ) ;
41
44
const [ detections ] = await translate . detect ( [ text , text2 ] ) ;
42
- const expected = `Detections:\n${ text } => ${ detections [ 0 ] . language } \n${ text2 } => ${ detections [ 1 ] . language } ` ;
45
+ const expected = `Detections:\n${ text } => ${ detections [ 0 ]
46
+ . language } \n${ text2 } => ${ detections [ 1 ] . language } `;
43
47
t . is ( output , expected ) ;
44
48
} ) ;
45
49
46
- test ( `should list languages` , async ( t ) => {
50
+ test ( `should list languages` , async t => {
47
51
const output = await tools . runAsync ( `${ cmd } list` , cwd ) ;
48
52
t . true ( output . includes ( `Languages:` ) ) ;
49
53
t . true ( output . includes ( `{ code: 'af', name: 'Afrikaans' }` ) ) ;
50
54
} ) ;
51
55
52
- test ( `should list languages with a target` , async ( t ) => {
56
+ test ( `should list languages with a target` , async t => {
53
57
const output = await tools . runAsync ( `${ cmd } list es` , cwd ) ;
54
58
t . true ( output . includes ( `Languages:` ) ) ;
55
59
t . true ( output . includes ( `{ code: 'af', name: 'afrikáans' }` ) ) ;
56
60
} ) ;
57
61
58
- test ( `should translate a single string` , async ( t ) => {
59
- const output = await tools . runAsync ( `${ cmd } translate ${ toLang } "${ text } "` , cwd ) ;
62
+ test ( `should translate a single string` , async t => {
63
+ const output = await tools . runAsync (
64
+ `${ cmd } translate ${ toLang } "${ text } "` ,
65
+ cwd
66
+ ) ;
60
67
const [ translation ] = await translate . translate ( text , toLang ) ;
61
68
const expected = `Translations:\n${ text } => (${ toLang } ) ${ translation } ` ;
62
69
t . is ( output , expected ) ;
63
70
} ) ;
64
71
65
- test ( `should translate multiple strings` , async ( t ) => {
66
- const output = await tools . runAsync ( `${ cmd } translate ${ toLang } "${ text } " "${ text2 } "` , cwd ) ;
72
+ test ( `should translate multiple strings` , async t => {
73
+ const output = await tools . runAsync (
74
+ `${ cmd } translate ${ toLang } "${ text } " "${ text2 } "` ,
75
+ cwd
76
+ ) ;
67
77
const [ translations ] = await translate . translate ( [ text , text2 ] , toLang ) ;
68
78
const expected = `Translations:\n${ text } => (${ toLang } ) ${ translations [ 0 ] } \n${ text2 } => (${ toLang } ) ${ translations [ 1 ] } ` ;
69
79
t . is ( output , expected ) ;
70
80
} ) ;
71
81
72
- test ( `should translate a single string with a model` , async ( t ) => {
73
- const output = await tools . runAsync ( `${ cmd } translate-with-model ${ toLang } ${ model } "${ text } "` , cwd ) ;
82
+ test ( `should translate a single string with a model` , async t => {
83
+ const output = await tools . runAsync (
84
+ `${ cmd } translate-with-model ${ toLang } ${ model } "${ text } "` ,
85
+ cwd
86
+ ) ;
74
87
const [ translation ] = await translate . translate ( text , toLang ) ;
75
88
const expected = `Translations:\n${ text } => (${ toLang } ) ${ translation } ` ;
76
89
t . is ( output , expected ) ;
77
90
} ) ;
78
91
79
- test ( `should translate multiple strings with a model` , async ( t ) => {
80
- const output = await tools . runAsync ( `${ cmd } translate-with-model ${ toLang } ${ model } "${ text } " "${ text2 } "` , cwd ) ;
92
+ test ( `should translate multiple strings with a model` , async t => {
93
+ const output = await tools . runAsync (
94
+ `${ cmd } translate-with-model ${ toLang } ${ model } "${ text } " "${ text2 } "` ,
95
+ cwd
96
+ ) ;
81
97
const [ translations ] = await translate . translate ( [ text , text2 ] , toLang ) ;
82
98
const expected = `Translations:\n${ text } => (${ toLang } ) ${ translations [ 0 ] } \n${ text2 } => (${ toLang } ) ${ translations [ 1 ] } ` ;
83
99
t . is ( output , expected ) ;
0 commit comments