@@ -218,4 +218,46 @@ describe('Tests for overlay actions', () => {
218
218
// Explicitly check the resulting base64 string
219
219
expect ( asset . toString ( ) ) . toContain ( `l_fetch:aHR0cHM6Ly9yZXMuY2xvdWRpbmFyeS5jb20vZGVtby9pbWFnZS91cGxvYWQvY2k=.png/${ sampleTxResizePad ( ) . toString ( ) } ` ) ;
220
220
} ) ;
221
+
222
+ it . skip ( "should serialize a text source" , ( ) => {
223
+ const asset = createNewImage ( ) ;
224
+ const text = 'Cloudinary for the win!' ;
225
+ const textStyle = sampleTextStyle ( ) ;
226
+ const textSource = Source . text ( text , textStyle ) ;
227
+ asset . overlay ( Overlay . source ( textSource ) ) ;
228
+
229
+ expect ( asset . toString ( ) ) . toBe ( "l_text:arial_50_bold_italic_strikethrough_justify_stroke_letter_spacing_10_line_spacing_20_letter_spacing_good_hinting_full:Cloudinary%20for%20the%20win%21'/fl_layer_apply" ) ;
230
+ } ) ;
231
+
232
+ it ( "should serialize a fetch source" , ( ) => {
233
+ const asset = createNewVideo ( ) ;
234
+ const REMOTE_URL = 'http://res.cloudinary.com/demo/sample.jpg' ;
235
+ const expected = 'l_fetch:aHR0cDovL3Jlcy5jbG91ZGluYXJ5LmNvbS9kZW1vL3NhbXBsZS5qcGc=/fl_layer_apply' ;
236
+ const actual = asset . overlay ( Overlay . source ( Source . fetch ( REMOTE_URL ) ) ) . toString ( ) ;
237
+
238
+ expect ( actual ) . toBe ( expected ) ;
239
+ } ) ;
240
+
241
+ it . skip ( "should serialize a unicode url of fetch source" , ( ) => {
242
+ const asset = createNewVideo ( ) ;
243
+ const REMOTE_URL = "https://upload.wikimedia.org/wikipedia/commons/2/2b/고창갯벌.jpg" ;
244
+ const expected = "l_fetch:aHR0cHM6Ly91cGxvYWQud2lraW1lZGlhLm9yZy93aWtpcGVkaWEvY29tbW9ucy8yLzJiLyVFQSVCMyVBMCVFQyVCMCVCRCVFQSVCMCVBRiVFQiVCMiU4Qy5qcGc=/fl_layer_apply" ;
245
+ const actual = asset . overlay ( Overlay . source ( Source . fetch ( REMOTE_URL ) ) ) . toString ( ) ;
246
+
247
+ expect ( actual ) . toBe ( expected ) ;
248
+ } ) ;
249
+
250
+ it . skip ( "should support string interpolation" , ( ) => {
251
+ const asset = createNewImage ( ) ;
252
+ const text = "$(start)Hello $(name)$(ext), $(no ) $( no)$(end)" ;
253
+ const textStyle = sampleTextStyle ( ) ;
254
+ const textSource = Source . text ( text , textStyle ) ;
255
+ asset . overlay ( Overlay . source ( textSource ) ) ;
256
+
257
+ expect ( asset . toString ( ) ) . toBe ( "l_text:arial_50_bold_italic_strikethrough_justify_stroke_letter_spacing_10_line_spacing_20_letter_spacing_good_hinting_full:$(start)Hello%20$(name)$(ext)%252C%20%24%28no%20%29%20%24%28%20no%29$(end)/fl_layer_apply" ) ;
258
+ } ) ;
259
+
260
+ it . skip ( "should throw an exception if fontFamily is not provided" , ( ) => {
261
+ expect ( ( ) => new TextStyle ( null , 17 ) ) . toThrow ( ) ;
262
+ } ) ;
221
263
} ) ;
0 commit comments