diff --git a/packages/falso/src/lib/img.ts b/packages/falso/src/lib/img.ts index d1184d7e..1f4d27cd 100644 --- a/packages/falso/src/lib/img.ts +++ b/packages/falso/src/lib/img.ts @@ -31,9 +31,9 @@ interface ImgOptions extends FakeOptions { * @example * * randImg({ grayscale: true }) // return a grayscale image (default is false) - * + * * @example - * + * * randImg({ random: true }) // default is true, prevent the image from being cached * */ @@ -56,7 +56,7 @@ export function randImg(options?: Options) { } return fake( - () => `https://picsum.photos/${width}/${height}${query.toString()}`, + () => `https://picsum.photos/${width}/${height}?${query.toString()}`, options ); } diff --git a/packages/falso/src/tests/product.spec.ts b/packages/falso/src/tests/product.spec.ts index 33015129..21ec42cc 100644 --- a/packages/falso/src/tests/product.spec.ts +++ b/packages/falso/src/tests/product.spec.ts @@ -15,4 +15,10 @@ describe('productCategory', () => { expect(typeof product.rating.rate).toEqual('string'); expect(typeof product.rating.count).toEqual('string'); }); + + it('should return a proper randImg link', () => { + const product = randProduct(); + + expect(product.image).toContain('?'); + }); });