@@ -97,6 +97,35 @@ verify_file_decompress() {
9797 grep -F ' Hello from Transloadit CLI intents' " $1 /input.txt" > /dev/null
9898}
9999
100+ verify_image_describe_labels () {
101+ node --input-type=module << 'NODE ' "$1"
102+ import { readFileSync } from 'node:fs'
103+
104+ const value = JSON.parse(readFileSync(process.argv[1], 'utf8'))
105+ const ok =
106+ Array.isArray(value) &&
107+ value.length > 0 &&
108+ value.every((item) => typeof item === 'string' || (item && typeof item.name === 'string'))
109+
110+ process.exit(ok ? 0 : 1)
111+ NODE
112+ }
113+
114+ verify_image_describe_wordpress () {
115+ node --input-type=module << 'NODE ' "$1"
116+ import { readFileSync } from 'node:fs'
117+
118+ const value = JSON.parse(readFileSync(process.argv[1], 'utf8'))
119+ const required = ['altText', 'title', 'caption', 'description']
120+ const ok =
121+ value &&
122+ typeof value === 'object' &&
123+ required.every((key) => typeof value[key] === 'string' && value[key].trim().length > 0)
124+
125+ process.exit(ok ? 0 : 1)
126+ NODE
127+ }
128+
100129verify_output () {
101130 local verifier=" $1 "
102131 local path=" $2 "
@@ -111,6 +140,8 @@ verify_output() {
111140 video-thumbs) verify_video_thumbs " $path " ;;
112141 video-encode-hls) verify_video_encode_hls " $path " ;;
113142 file-decompress) verify_file_decompress " $path " ;;
143+ image-describe-labels) verify_image_describe_labels " $path " ;;
144+ image-describe-wordpress) verify_image_describe_wordpress " $path " ;;
114145 * )
115146 echo " Unknown verifier: $verifier " >&2
116147 return 1
@@ -198,6 +229,31 @@ for (const smokeCase of intentSmokeCases) {
198229 smokeCase.verifier,
199230 ].join('\t'))
200231}
232+
233+ for (const smokeCase of [
234+ {
235+ name: 'image-describe-labels',
236+ paths: ['image', 'describe'],
237+ args: ['--input', '@fixture/input.jpg', '--fields', 'labels'],
238+ outputPath: 'image-describe-labels.json',
239+ verifier: 'image-describe-labels',
240+ },
241+ {
242+ name: 'image-describe-wordpress',
243+ paths: ['image', 'describe'],
244+ args: ['--input', '@fixture/input.jpg', '--for', 'wordpress'],
245+ outputPath: 'image-describe-wordpress.json',
246+ verifier: 'image-describe-wordpress',
247+ },
248+ ]) {
249+ console.log([
250+ smokeCase.name,
251+ smokeCase.paths.join(' '),
252+ smokeCase.args.join('\x1f'),
253+ smokeCase.outputPath,
254+ smokeCase.verifier,
255+ ].join('\t'))
256+ }
201257NODE
202258)
203259
0 commit comments