@@ -41,13 +41,54 @@ describe("Plugins", () => {
4141 gravity : "east" ,
4242 prompt : "pink and purple flowers" ,
4343 crop : "mpad" ,
44+ seed : 3
4445 } ,
4546 } as const ;
4647
4748 FillBackgroundPlugin . apply ( cldImage , options ) ;
4849
4950 expect ( cldImage . toURL ( ) ) . toContain (
50- `b_gen_fill:${ encodeURIComponent ( options . fillBackground . prompt ) } ,ar_${ options . width } :${ options . height } ,c_${ options . fillBackground . crop } ,g_${ options . fillBackground . gravity } /${ TEST_PUBLIC_ID } ` ,
51+ `b_gen_fill:prompt_${ encodeURIComponent ( options . fillBackground . prompt ) } ;seed_3,ar_${ options . width } :${ options . height } ,c_${ options . fillBackground . crop } ,g_${ options . fillBackground . gravity } /${ TEST_PUBLIC_ID } ` ,
52+ ) ;
53+ } ) ;
54+
55+ it ( "should generate with just a seed but no prompt" , ( ) => {
56+ const cldImage = cld . image ( TEST_PUBLIC_ID ) ;
57+
58+ const options = {
59+ src : TEST_PUBLIC_ID ,
60+ width : 800 ,
61+ height : 600 ,
62+ fillBackground : {
63+ crop : 'pad' ,
64+ seed : 3
65+ } ,
66+ } as const ;
67+
68+ FillBackgroundPlugin . apply ( cldImage , options ) ;
69+
70+ expect ( cldImage . toURL ( ) ) . toContain (
71+ `b_gen_fill:seed_3,ar_${ options . width } :${ options . height } ,c_${ options . fillBackground . crop } /${ TEST_PUBLIC_ID } ` ,
72+ ) ;
73+ } ) ;
74+
75+ it ( "should generate with just a prompt but no seed" , ( ) => {
76+ const cldImage = cld . image ( TEST_PUBLIC_ID ) ;
77+
78+ const options = {
79+ src : TEST_PUBLIC_ID ,
80+ width : 800 ,
81+ height : 600 ,
82+ fillBackground : {
83+ crop : 'pad' ,
84+ prompt : 'a herd of llamas'
85+ } ,
86+ } as const ;
87+
88+ FillBackgroundPlugin . apply ( cldImage , options ) ;
89+
90+ expect ( cldImage . toURL ( ) ) . toContain (
91+ `b_gen_fill:prompt_${ encodeURIComponent ( options . fillBackground . prompt ) } ,ar_${ options . width } :${ options . height } ,c_${ options . fillBackground . crop } /${ TEST_PUBLIC_ID } ` ,
5192 ) ;
5293 } ) ;
5394
0 commit comments