next-cloudinary 0.0.11 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -8
- package/babel.config.js +3 -0
- package/dist/next-cloudinary.js +96 -75
- package/dist/next-cloudinary.js.map +1 -1
- package/dist/next-cloudinary.modern.mjs +94 -73
- package/dist/next-cloudinary.modern.mjs.map +1 -1
- package/dist/next-cloudinary.module.js +96 -75
- package/dist/next-cloudinary.module.js.map +1 -1
- package/dist/next-cloudinary.umd.js +96 -75
- package/dist/next-cloudinary.umd.js.map +1 -1
- package/jest.config.js +12 -0
- package/package.json +9 -2
- package/tests/lib/cloudinary.spec.js +28 -0
- package/tests/plugins/raw-transformations.spec.js +54 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Cloudinary } from '@cloudinary/url-gen';
|
|
2
|
+
|
|
3
|
+
import * as rawTransformationsPlugin from '../../src/plugins/raw-transformations';
|
|
4
|
+
|
|
5
|
+
const { plugin } = rawTransformationsPlugin
|
|
6
|
+
|
|
7
|
+
const cld = new Cloudinary({
|
|
8
|
+
cloud: {
|
|
9
|
+
cloudName: 'test-cloud-name'
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const TEST_PUBLIC_ID = 'test-public-id';
|
|
14
|
+
|
|
15
|
+
describe('Plugins', () => {
|
|
16
|
+
describe('Raw Transformations', () => {
|
|
17
|
+
it('should apply a single raw transformations to the end of a Cloudinary URL', () => {
|
|
18
|
+
|
|
19
|
+
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
20
|
+
|
|
21
|
+
const cldOptions = {
|
|
22
|
+
rawTransformations: [
|
|
23
|
+
'e_blur:2000'
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
plugin({
|
|
28
|
+
cldImage,
|
|
29
|
+
cldOptions
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
expect(cldImage.toURL()).toContain(`${cldOptions.rawTransformations.join('/')}/${TEST_PUBLIC_ID}`);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should apply an array of raw transformations to the end of a Cloudinary URL', () => {
|
|
36
|
+
|
|
37
|
+
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
38
|
+
|
|
39
|
+
const cldOptions = {
|
|
40
|
+
rawTransformations: [
|
|
41
|
+
'e_blur:2000',
|
|
42
|
+
'e_tint:100:0000FF:0p:FF1493:100p'
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
plugin({
|
|
47
|
+
cldImage,
|
|
48
|
+
cldOptions
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
expect(cldImage.toURL()).toContain(`${cldOptions.rawTransformations.join('/')}/${TEST_PUBLIC_ID}`);
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
});
|