summaryrefslogtreecommitdiff
path: root/packages/integrations/image/test/rotation.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/image/test/rotation.test.js')
-rw-r--r--packages/integrations/image/test/rotation.test.js86
1 files changed, 26 insertions, 60 deletions
diff --git a/packages/integrations/image/test/rotation.test.js b/packages/integrations/image/test/rotation.test.js
index b31910abd..06f74d1c2 100644
--- a/packages/integrations/image/test/rotation.test.js
+++ b/packages/integrations/image/test/rotation.test.js
@@ -29,72 +29,38 @@ describe('Image rotation', function () {
$ = cheerio.load(html);
});
- describe('Landscape images', () => {
- const hashes = [
- '/Landscape_0.080ebd7a_ZdTMkT.jpg',
- '/Landscape_1.c92e81c9_4Eikw.jpg',
- '/Landscape_2.f54c85e5_1iKxtI.jpg',
- '/Landscape_3.8e20af03_Z2sFwFL.jpg',
- '/Landscape_4.15f511b0_1dNJQt.jpg',
- '/Landscape_5.6d88c17f_ZtLntP.jpg',
- '/Landscape_6.1a88f6d8_Z1Pl4xy.jpg',
- '/Landscape_7.cb1008c2_Z1JYr40.jpg',
- '/Landscape_8.3d2837d2_1xTOBN.jpg',
- ];
+ it('Landscape images', () => {
+ for (let i = 0; i < 9; i++) {
+ const image = $(`#landscape-${i}`);
+ const regex = new RegExp(`\^/Landscape_${i}.\\w{8}_\\w{4,10}.jpg`);
- it('includes <img> attributes', () => {
- for (let i = 0; i < 9; i++) {
- const image = $(`#landscape-${i}`);
+ expect(image.attr('src')).to.match(regex);
+ expect(image.attr('width')).to.equal('1800');
+ expect(image.attr('height')).to.equal('1200');
- expect(image.attr('src')).to.equal(hashes[i]);
- expect(image.attr('width')).to.equal('1800');
- expect(image.attr('height')).to.equal('1200');
- }
- });
-
- it('built the optimized image', () => {
- for (let i = 0; i < 9; i++) {
- verifyImage(hashes[i], {
- width: 1800,
- height: 1200,
- type: 'jpg',
- });
- }
- });
+ verifyImage(image.attr('src'), {
+ width: 1800,
+ height: 1200,
+ type: 'jpg',
+ });
+ }
});
- describe('Portait images', () => {
- const hashes = [
- '/Portrait_0.e09ae908_5e5uz.jpg',
- '/Portrait_1.c7b4942e_1RJQep.jpg',
- '/Portrait_2.8e8be39f_T6sr4.jpg',
- '/Portrait_3.1dcc58b4_Z1uaoxA.jpg',
- '/Portrait_4.2f89d418_ZLQlNB.jpg',
- '/Portrait_5.b3b6cc6f_Z23Ek26.jpg',
- '/Portrait_6.94e06390_ak2Ek.jpg',
- '/Portrait_7.9ffdecfe_Z1S4klG.jpg',
- '/Portrait_8.9d01343d_2dak03.jpg',
- ];
-
- it('includes <img> attributes', () => {
- for (let i = 0; i < 9; i++) {
- const image = $(`#portrait-${i}`);
+ it('Portait images', () => {
+ for (let i = 0; i < 9; i++) {
+ const image = $(`#portrait-${i}`);
+ const regex = new RegExp(`\^/Portrait_${i}.\\w{8}_\\w{4,10}.jpg`);
- expect(image.attr('src')).to.equal(hashes[i]);
- expect(image.attr('width')).to.equal('1200');
- expect(image.attr('height')).to.equal('1800');
- }
- });
+ expect(image.attr('src')).to.match(regex);
+ expect(image.attr('width')).to.equal('1200');
+ expect(image.attr('height')).to.equal('1800');
- it('built the optimized image', () => {
- for (let i = 0; i < 9; i++) {
- verifyImage(hashes[i], {
- width: 1200,
- height: 1800,
- type: 'jpg',
- });
- }
- });
+ verifyImage(image.attr('src'), {
+ width: 1200,
+ height: 1800,
+ type: 'jpg',
+ });
+ }
});
});
});