MCPcopy
hub / github.com/faker-js/faker / assertValidUrl

Function assertValidUrl

test/modules/image.spec.ts:19–23  ·  view source on GitHub ↗

* Checks that the given address is a valid https address. * * An address is considered valid, if it: * * - is a string * - starts with https * - is a proper url * * There is a separate integretation test file for checking if the address is reachable. * * @param address The address to check

(address: string)

Source from the content-addressed store, hash-verified

17 * @param address The address to check.
18 */
19function assertValidUrl(address: string): void {
20 expect(address).toBeTypeOf('string');
21 expect(address).toMatch(/^https:\/\//);
22 expect(() => new URL(address)).not.toThrow();
23}
24
25describe('image', () => {
26 seededTests(faker, 'image', (t) => {

Callers 1

image.spec.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected