Skip to content

Commit 6f93838

Browse files
committed
fix test case
1 parent 82b5f63 commit 6f93838

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

test/url-generation/overlay.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ const expect = chai.expect;
33
const initializationParams = require("../data").initializationParams;
44
import ImageKit from "../../src/index";
55
import { safeBtoa } from "../../src/utils/transformation";
6-
describe.only("Comprehensive Overlay Transformation Cases", function () {
6+
describe("Overlay Transformation Test Cases", function () {
77
const imagekit = new ImageKit(initializationParams);
88

9-
it('simple text overlay', function () {
9+
it('Text overlay generates correct URL with encoded overlay text', function () {
1010
const url = imagekit.url({
1111
path: "/base-image.jpg",
1212
transformation: [{
@@ -19,7 +19,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
1919
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-text,ie-${encodeURIComponent(safeBtoa("Minimal Text"))},l-end/base-image.jpg`);
2020
});
2121

22-
it('simple image overlay', function () {
22+
it('Image overlay generates correct URL with input logo.png', function () {
2323
const url = imagekit.url({
2424
path: "/base-image.jpg",
2525
transformation: [{
@@ -32,7 +32,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
3232
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-logo.png,l-end/base-image.jpg`);
3333
});
3434

35-
it('simple video overlay', function () {
35+
it('Video overlay generates correct URL with input play-pause-loop.mp4', function () {
3636
const url = imagekit.url({
3737
path: "/base-video.mp4",
3838
transformation: [{
@@ -45,7 +45,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
4545
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-video,i-play-pause-loop.mp4,l-end/base-video.mp4`);
4646
});
4747

48-
it("simple subtitle overlay", function () {
48+
it("Subtitle overlay generates correct URL with input subtitle.srt", function () {
4949
const url = imagekit.url({
5050
path: "/base-video.mp4",
5151
transformation: [{
@@ -58,7 +58,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
5858
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-subtitle,i-subtitle.srt,l-end/base-video.mp4`);
5959
});
6060

61-
it("simple solid color overlay", function () {
61+
it("Solid color overlay generates correct URL with background color FF0000", function () {
6262
const url = imagekit.url({
6363
path: "/base-image.jpg",
6464
transformation: [{
@@ -71,7 +71,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
7171
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-ik_canvas,bg-FF0000,l-end/base-image.jpg`);
7272
});
7373

74-
it('All combined', function () {
74+
it('Combined overlay transformations generate correct URL including nested overlays', function () {
7575
const url = imagekit.url({
7676
path: "/base-image.jpg",
7777
transformation: [
@@ -90,7 +90,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
9090
duration: "10",
9191
end: 15
9292
},
93-
transformations: [{
93+
transformation: [{
9494
width: "bw_mul_0.5",
9595
fontSize: 20,
9696
fontFamily: "Arial",
@@ -122,7 +122,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
122122
duration: "10",
123123
end: 15
124124
},
125-
transformations: [
125+
transformation: [
126126
{
127127
width: "bw_mul_0.5",
128128
height: "bh_mul_0.5",
@@ -197,7 +197,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
197197
duration: "10",
198198
end: 15
199199
},
200-
transformations: [{
200+
transformation: [{
201201
width: "bw_mul_0.5",
202202
height: "bh_mul_0.5",
203203
rotation: "N45",
@@ -207,6 +207,7 @@ describe.only("Comprehensive Overlay Transformation Cases", function () {
207207
}
208208
]
209209
});
210-
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-text,ie-${encodeURIComponent(safeBtoa("Every thing"))},lxo-10,lyo-20,lfo-center,lso-5,ldu-10,leo-15,w-bw_mul_0.5,fs-20,ff-Arial,fc-0000ff,ia-left,pa-5,al-7,tg-b,bg-red,r-10,rt-N45,fl-h,lh-20,l-end:l-image,i-logo.png,lxo-10,lyo-20,lfo-center,lso-5,ldu-10,leo-15,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-text,ie-${encodeURIComponent(safeBtoa("Nested text overlay"))},l-end,l-end:l-video,i-play-pause-loop.mp4,lxo-10,lyo-20,lfo-center,lso-5,ldu-10,leo-15,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end:l-subtitle,i-subtitle.srt,lxo-10,lyo-20,lfo-center,lso-5,ldu-10,leo-15,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end:l-image,i-ik_canvas,bg-FF0000,lxo-10,lyo-20,lfo-center,lso-5,ldu-10,leo-15,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end:l-image,i-ik_canvas,bg-FF0000,lxo-10,lyo-20,lfo-center,lso-5,ldu-10,leo-15,w-bw_mul_0.5,l-end/base-image.jpg`);
210+
211+
expect(url).equal(`https://ik.imagekit.io/test_url_endpoint/tr:l-text,ie-${encodeURIComponent(safeBtoa("Every thing"))},lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,fs-20,ff-Arial,co-0000ff,ia-left,pa-5,al-7,tg-b,bg-red,r-10,rt-N45,fl-h,lh-20,l-end:l-image,i-logo.png,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-text,ie-${encodeURIComponent(safeBtoa("Nested text overlay"))},l-end,l-end:l-video,i-play-pause-loop.mp4,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,l-end:l-subtitle,i-subtitle.srt,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,l-end:l-image,i-ik_canvas,bg-FF0000,lxo-10,lyo-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end/base-image.jpg`)
211212
});
212213
});

0 commit comments

Comments
 (0)