next-cloudinary 0.3.0 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-cloudinary",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "main": "dist/next-cloudinary.umd.js",
5
5
  "module": "dist/next-cloudinary.module.js",
6
6
  "umd:main": "dist/next-cloudinary.umd.js",
@@ -13,20 +13,20 @@
13
13
  "test": "jest"
14
14
  },
15
15
  "dependencies": {
16
- "@cloudinary/url-gen": "^1.8.5"
16
+ "@cloudinary/url-gen": "^1.8.6"
17
17
  },
18
18
  "devDependencies": {
19
- "@babel/core": "^7.19.3",
20
- "@babel/preset-env": "^7.19.3",
21
- "@types/jest": "^29.1.1",
22
- "babel-jest": "^29.1.2",
19
+ "@babel/core": "^7.19.6",
20
+ "@babel/preset-env": "^7.19.4",
21
+ "@types/jest": "^29.2.0",
22
+ "babel-jest": "^29.2.2",
23
23
  "dotenv": "^16.0.3",
24
- "jest": "^29.1.2",
25
- "jest-environment-jsdom": "^29.1.2",
24
+ "jest": "^29.2.2",
25
+ "jest-environment-jsdom": "^29.2.2",
26
26
  "microbundle": "^0.15.1"
27
27
  },
28
28
  "peerDependencies": {
29
- "next": "^12.2.5",
29
+ "next": "^12.0.0 || ^13.0.0",
30
30
  "react": "^18.2.0"
31
31
  }
32
32
  }
@@ -13,7 +13,7 @@ const cld = new Cloudinary({
13
13
  const TEST_PUBLIC_ID = 'test-public-id';
14
14
 
15
15
  describe('Cropping plugin', () => {
16
- it('should apply the correct transformation string', () => {
16
+ it('should apply a crop and gravity to a URL', () => {
17
17
  const cldImage = cld.image(TEST_PUBLIC_ID);
18
18
  const options = {
19
19
  width: 100,
@@ -22,6 +22,17 @@ describe('Cropping plugin', () => {
22
22
  gravity: 'auto'
23
23
  };
24
24
  plugin({ cldImage, options });
25
- expect(cldImage.toURL()).toEqual('https://res.cloudinary.com/test-cloud-name/image/upload/c_crop,w_100,h_100,g_auto/test-public-id?_a=ATMZxAA0');
25
+ expect(cldImage.toURL()).toContain(`c_${options.crop},w_${options.width},h_${options.height},g_${options.gravity}/${TEST_PUBLIC_ID}`);
26
+ });
27
+
28
+ it('should apply a gravity of auto by default if not set explicitly', () => {
29
+ const cldImage = cld.image(TEST_PUBLIC_ID);
30
+ const options = {
31
+ width: 100,
32
+ height: 100,
33
+ crop: 'fill'
34
+ };
35
+ plugin({ cldImage, options });
36
+ expect(cldImage.toURL()).toContain(`c_${options.crop},w_${options.width},h_${options.height},g_auto/${TEST_PUBLIC_ID}`);
26
37
  });
27
38
  });