Skip to content

Commit 9022bbf

Browse files
Add missing tests (#301)
1 parent ef85963 commit 9022bbf

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

__TESTS__/unit/urlConfig.test.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,22 @@ describe('It tests a combination of Cloudinary URL and Configuration', () => {
123123
});
124124
expect(url).toContain('https://something.cloudfront.net/image/upload/');
125125
});
126-
});
127126

127+
it('Generates a URL with version in the public ID', () => {
128+
const img = createNewImage('v1234/foo/sample', {cloudName: 'demo'}, { forceVersion: true});
128129

129-
/**
130-
* http://res.cloudinary.com/{cloudName}
131-
* https://res.cloudinary.com/{cloudName}
132-
* https://{cloudName}-res.cloudinary.com/
133-
* http://{domain}
134-
* https://{domain}
135-
*/
130+
expect(img.toURL()).toContain('https://res.cloudinary.com/demo/image/upload/v1234/foo/sample');
131+
});
132+
133+
it('Generates a URL with V1', () => {
134+
const img = createNewImage('foo/sample', {cloudName: 'demo'}, { forceVersion: true});
135+
136+
expect(img.toURL()).toContain('https://res.cloudinary.com/demo/image/upload/v1/foo/sample');
137+
});
138+
139+
it('Generates a URL without V1', () => {
140+
const img = createNewImage('foo/sample', {cloudName: 'demo'}, { forceVersion: false});
141+
142+
expect(img.toURL()).toContain('https://res.cloudinary.com/demo/image/upload/foo/sample');
143+
});
144+
});

0 commit comments

Comments
 (0)