44
55import { exampleText , makeDeeplClient , testTimeout , withRealServer } from './core' ;
66
7- import { WritingTone , WritingStyle } from './../src/deeplClient' ;
7+ import { WritingStyle , WritingTone } from './../src/deeplClient' ;
88
99describe ( 'rephrase text' , ( ) => {
1010 it ( 'should rephrase a single text' , async ( ) => {
@@ -22,6 +22,34 @@ describe('rephrase text', () => {
2222 await expect ( deeplClientPromise ) . rejects . toThrow ( / V a l u e f o r ' t a r g e t _ l a n g ' n o t s u p p o r t e d / ) ;
2323 } ) ;
2424
25+ it ( 'should throw an error for unsupported tone' , async ( ) => {
26+ const deeplClient = makeDeeplClient ( ) ;
27+ const deeplClientPromise = deeplClient . rephraseText (
28+ exampleText . de ,
29+ 'es' ,
30+ null ,
31+ WritingTone . CONFIDENT ,
32+ ) ;
33+ await expect ( deeplClientPromise ) . rejects . toBeInstanceOf ( Error ) ;
34+ await expect ( deeplClientPromise ) . rejects . toThrow (
35+ / L a n g u a g e S p a n i s h d o e s n o t s u p p o r t s e t t i n g a t o n e / ,
36+ ) ;
37+ } ) ;
38+
39+ it ( 'should throw an error for invalid writing_style parameter' , async ( ) => {
40+ const deeplClient = makeDeeplClient ( ) ;
41+ const deeplClientPromise = deeplClient . rephraseText (
42+ exampleText . de ,
43+ 'es' ,
44+ WritingStyle . BUSINESS ,
45+ null ,
46+ ) ;
47+ await expect ( deeplClientPromise ) . rejects . toBeInstanceOf ( Error ) ;
48+ await expect ( deeplClientPromise ) . rejects . toThrow (
49+ / L a n g u a g e S p a n i s h d o e s n o t s u p p o r t s e t t i n g a w r i t i n g s t y l e / ,
50+ ) ;
51+ } ) ;
52+
2553 withRealServer (
2654 'should rephrase with style and tone' ,
2755 async ( ) => {
0 commit comments