Skip to content

Commit 893c452

Browse files
authored
fix: broken randImg (#404)
1 parent c8a6827 commit 893c452

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/falso/src/lib/img.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ interface ImgOptions extends FakeOptions {
3131
* @example
3232
*
3333
* randImg({ grayscale: true }) // return a grayscale image (default is false)
34-
*
34+
*
3535
* @example
36-
*
36+
*
3737
* randImg({ random: true }) // default is true, prevent the image from being cached
3838
*
3939
*/
@@ -56,7 +56,7 @@ export function randImg<Options extends ImgOptions = never>(options?: Options) {
5656
}
5757

5858
return fake(
59-
() => `https://picsum.photos/${width}/${height}${query.toString()}`,
59+
() => `https://picsum.photos/${width}/${height}?${query.toString()}`,
6060
options
6161
);
6262
}

packages/falso/src/tests/product.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ describe('productCategory', () => {
1515
expect(typeof product.rating.rate).toEqual('string');
1616
expect(typeof product.rating.count).toEqual('string');
1717
});
18+
19+
it('should return a proper randImg link', () => {
20+
const product = randProduct();
21+
22+
expect(product.image).toContain('?');
23+
});
1824
});

0 commit comments

Comments
 (0)