1515
1616'use strict' ;
1717
18- const path = require ( ` path` ) ;
19- const test = require ( `ava` ) ;
20- const tools = require ( ` @google-cloud/nodejs-repo-tools` ) ;
21- const { Translate} = require ( ` @google-cloud/translate` ) ;
18+ const path = require ( ' path' ) ;
19+ const assert = require ( 'assert' ) ;
20+ const tools = require ( ' @google-cloud/nodejs-repo-tools' ) ;
21+ const { Translate} = require ( ' @google-cloud/translate' ) ;
2222const translate = new Translate ( ) ;
2323
24- const cwd = path . join ( __dirname , `..` ) ;
25- const cmd = ` node translate.js` ;
26- const text = ` Hello world!` ;
27- const text2 = ` Goodbye!` ;
28- const model = ` nmt` ;
29- const toLang = `ru` ;
24+ const cwd = path . join ( __dirname , '..' ) ;
25+ const cmd = ' node translate.js' ;
26+ const text = ' Hello world!' ;
27+ const text2 = ' Goodbye!' ;
28+ const model = ' nmt' ;
29+ const toLang = 'ru' ;
3030
31- test . before ( tools . checkCredentials ) ;
31+ before ( tools . checkCredentials ) ;
3232
33- test ( ` should detect language of a single string` , async t => {
33+ it ( ' should detect language of a single string' , async ( ) => {
3434 const output = await tools . runAsync ( `${ cmd } detect "${ text } "` , cwd ) ;
3535 const [ detection ] = await translate . detect ( text ) ;
3636 const expected = `Detections:\n${ text } => ${ detection . language } ` ;
37- t . is ( output , expected ) ;
37+ assert . strictEqual ( output , expected ) ;
3838} ) ;
3939
40- test ( ` should detect language of multiple strings` , async t => {
40+ it ( ' should detect language of multiple strings' , async ( ) => {
4141 const output = await tools . runAsync (
4242 `${ cmd } detect "${ text } " "${ text2 } "` ,
4343 cwd
@@ -46,32 +46,32 @@ test(`should detect language of multiple strings`, async t => {
4646 const expected = `Detections:\n${ text } => ${
4747 detections [ 0 ] . language
4848 } \n${ text2 } => ${ detections [ 1 ] . language } `;
49- t . is ( output , expected ) ;
49+ assert . strictEqual ( output , expected ) ;
5050} ) ;
5151
52- test ( ` should list languages` , async t => {
52+ it ( ' should list languages' , async ( ) => {
5353 const output = await tools . runAsync ( `${ cmd } list` , cwd ) ;
54- t . true ( output . includes ( ` Languages:` ) ) ;
55- t . true ( output . includes ( `{ code: 'af', name: 'Afrikaans' }` ) ) ;
54+ assert . ok ( output . includes ( ' Languages:' ) ) ;
55+ assert . ok ( output . includes ( `{ code: 'af', name: 'Afrikaans' }` ) ) ;
5656} ) ;
5757
58- test ( ` should list languages with a target` , async t => {
58+ it ( ' should list languages with a target' , async ( ) => {
5959 const output = await tools . runAsync ( `${ cmd } list es` , cwd ) ;
60- t . true ( output . includes ( ` Languages:` ) ) ;
61- t . true ( output . includes ( `{ code: 'af', name: 'afrikáans' }` ) ) ;
60+ assert . ok ( output . includes ( ' Languages:' ) ) ;
61+ assert . ok ( output . includes ( `{ code: 'af', name: 'afrikáans' }` ) ) ;
6262} ) ;
6363
64- test ( ` should translate a single string` , async t => {
64+ it ( ' should translate a single string' , async ( ) => {
6565 const output = await tools . runAsync (
6666 `${ cmd } translate ${ toLang } "${ text } "` ,
6767 cwd
6868 ) ;
6969 const [ translation ] = await translate . translate ( text , toLang ) ;
7070 const expected = `Translations:\n${ text } => (${ toLang } ) ${ translation } ` ;
71- t . is ( output , expected ) ;
71+ assert . strictEqual ( output , expected ) ;
7272} ) ;
7373
74- test ( ` should translate multiple strings` , async t => {
74+ it ( ' should translate multiple strings' , async ( ) => {
7575 const output = await tools . runAsync (
7676 `${ cmd } translate ${ toLang } "${ text } " "${ text2 } "` ,
7777 cwd
@@ -80,20 +80,20 @@ test(`should translate multiple strings`, async t => {
8080 const expected = `Translations:\n${ text } => (${ toLang } ) ${
8181 translations [ 0 ]
8282 } \n${ text2 } => (${ toLang } ) ${ translations [ 1 ] } `;
83- t . is ( output , expected ) ;
83+ assert . strictEqual ( output , expected ) ;
8484} ) ;
8585
86- test ( ` should translate a single string with a model` , async t => {
86+ it ( ' should translate a single string with a model' , async ( ) => {
8787 const output = await tools . runAsync (
8888 `${ cmd } translate-with-model ${ toLang } ${ model } "${ text } "` ,
8989 cwd
9090 ) ;
9191 const [ translation ] = await translate . translate ( text , toLang ) ;
9292 const expected = `Translations:\n${ text } => (${ toLang } ) ${ translation } ` ;
93- t . is ( output , expected ) ;
93+ assert . strictEqual ( output , expected ) ;
9494} ) ;
9595
96- test ( ` should translate multiple strings with a model` , async t => {
96+ it ( ' should translate multiple strings with a model' , async ( ) => {
9797 const output = await tools . runAsync (
9898 `${ cmd } translate-with-model ${ toLang } ${ model } "${ text } " "${ text2 } "` ,
9999 cwd
@@ -102,5 +102,5 @@ test(`should translate multiple strings with a model`, async t => {
102102 const expected = `Translations:\n${ text } => (${ toLang } ) ${
103103 translations [ 0 ]
104104 } \n${ text2 } => (${ toLang } ) ${ translations [ 1 ] } `;
105- t . is ( output , expected ) ;
105+ assert . strictEqual ( output , expected ) ;
106106} ) ;
0 commit comments