@@ -31,8 +31,8 @@ describe("IkVideoComponent", () => {
3131
3232 it ( "urlEndpoint passed to component should be used over initialized value" , ( ) => {
3333 let options : IkVideoComponentOptions = {
34- path : "def " ,
35- urlEndpoint : "https://example.com "
34+ urlEndpoint : "https://example.com " ,
35+ path : "def "
3636 } ;
3737 component . setUrl ( options ) ;
3838 expect ( component . url ) . toBe ( `https://example.com/def` ) ;
@@ -49,6 +49,7 @@ describe("IkVideoComponent", () => {
4949 let elRef : ElementRef ;
5050 comp = new IkVideoComponent ( elRef , iKService ) ;
5151 let options : IkVideoComponentOptions = {
52+ urlEndpoint : "https://ik.imagekit.io/company/" ,
5253 path : "/sample-video.mp4"
5354 } ;
5455 comp . setUrl ( options ) ;
@@ -65,6 +66,7 @@ describe("IkVideoComponent", () => {
6566 it ( "new unsupported transformation parameter is passed then it should come in URL as it is" , ( ) => {
6667 const transformation = [ { foo : "200" , bar : "200" } ] ;
6768 let options : IkVideoComponentOptions = {
69+ urlEndpoint : "https://ik.imagekit.io/company/" ,
6870 src : "https://abc.com/def" ,
6971 transformation : transformation
7072 } ;
@@ -75,6 +77,7 @@ describe("IkVideoComponent", () => {
7577 it ( "supported transformation parameter is passed then it should come in query parameters after transformation" , ( ) => {
7678 const transformation = [ { height : "200" , width : "200" } , { rotation : "90" } ] ;
7779 let options : IkVideoComponentOptions = {
80+ urlEndpoint : "https://ik.imagekit.io/company/" ,
7881 src : "https://abc.com/def" ,
7982 transformation : transformation
8083 } ;
@@ -85,6 +88,7 @@ describe("IkVideoComponent", () => {
8588 it ( "if SRC is used to create URL, transformartioPosition should be query" , ( ) => {
8689 const transformation = [ { height : "200" , width : "200" } , { rotation : "90" } ] ;
8790 let options : IkVideoComponentOptions = {
91+ urlEndpoint : "https://ik.imagekit.io/company/" ,
8892 src : "https://abc.com/def" ,
8993 transformation : transformation
9094 } ;
@@ -95,6 +99,7 @@ describe("IkVideoComponent", () => {
9599 it ( "if SRC is used to create URL, transformationPosition should be query even if anything else is passed" , ( ) => {
96100 const transformation = [ { height : "200" , width : "200" } , { rotation : "90" } ] ;
97101 let options : IkVideoComponentOptions = {
102+ urlEndpoint : "https://ik.imagekit.io/company/" ,
98103 src : "https://example.com/sample-video.mp4" ,
99104 transformation : transformation ,
100105 transformationPosition : "path"
@@ -109,6 +114,7 @@ describe("IkVideoComponent", () => {
109114 it ( "if PATH is used to create URL, transformartionPosition should be kept as is" , ( ) => {
110115 const transformation = [ { height : "200" , width : "200" } , { rotation : "90" } ] ;
111116 let options : IkVideoComponentOptions = {
117+ urlEndpoint : "https://ik.imagekit.io/company/" ,
112118 path : "sample-video.mp4" ,
113119 transformation : transformation ,
114120 transformationPosition : "query"
@@ -122,6 +128,7 @@ describe("IkVideoComponent", () => {
122128
123129 it ( "Parameters passed to queryParameters should be present in URL if src is used" , ( ) => {
124130 let options : IkVideoComponentOptions = {
131+ urlEndpoint : "https://ik.imagekit.io/company/" ,
125132 src : "https://example.com/sample-video.mp4" ,
126133 queryParameters : { version :5 , name : 'check' }
127134 } ;
@@ -131,6 +138,7 @@ describe("IkVideoComponent", () => {
131138
132139 it ( "Parameters passed to queryParameters should be present in URL if src with existing query is used" , ( ) => {
133140 let options : IkVideoComponentOptions = {
141+ urlEndpoint : "https://ik.imagekit.io/company/" ,
134142 src : "https://example.com/sample-video.mp4?foo=bar&baz=nax" ,
135143 queryParameters : { version :5 , name : 'check' }
136144 } ;
@@ -141,6 +149,7 @@ describe("IkVideoComponent", () => {
141149
142150 it ( "Parameters passed to queryParameters should be present in URL if path is used" , ( ) => {
143151 let options : IkVideoComponentOptions = {
152+ urlEndpoint : "https://ik.imagekit.io/company/" ,
144153 path : "/default.png" ,
145154 queryParameters : { version :6 , name : 'bar' }
146155 } ;
@@ -150,6 +159,7 @@ describe("IkVideoComponent", () => {
150159
151160 it ( "setUrl should create correct URL when src is provided" , ( ) => {
152161 let options : IkVideoComponentOptions = {
162+ urlEndpoint : "https://ik.imagekit.io/company/" ,
153163 src : "https://test-absolute-path.com/sample-video.mp4"
154164 } ;
155165 component . setUrl ( options ) ;
@@ -158,22 +168,34 @@ describe("IkVideoComponent", () => {
158168
159169 it ( "setUrl should create correct URL when path is provided" , ( ) => {
160170 let options : IkVideoComponentOptions = {
171+ urlEndpoint : "https://ik.imagekit.io/company/" ,
161172 path : "def"
162173 } ;
163174 component . setUrl ( options ) ;
164175 expect ( component . url ) . toContain ( `https://ik.imagekit.io/company/def` ) ;
165176 } ) ;
166177
178+ it ( "if urlEndpoint not set, expect errors to be thrown" , ( ) => {
179+ const transformation = [ { height : "200" , width : "200" } , { rotation : "90" } ] ;
180+ let options : IkVideoComponentOptions = {
181+ transformation : transformation ,
182+ transformationPosition : "query"
183+ } ;
184+ expect ( ( ) => component . getConfigObject ( options ) ) . toThrow ( new Error ( 'Missing urlEndpoint initialization!' ) ) ;
185+ } ) ;
186+
167187 it ( "if SRC and PATH not set, expect errors to be thrown" , ( ) => {
168188 const transformation = [ { height : "200" , width : "200" } , { rotation : "90" } ] ;
169189 let options : IkVideoComponentOptions = {
190+ urlEndpoint : 'https://ik.imagekit.io/example' ,
170191 transformation : transformation ,
171192 transformationPosition : "query"
172193 } ;
173194 expect ( ( ) => component . getConfigObject ( options ) ) . toThrow ( new Error ( 'Missing src / path during initialization!' ) ) ;
174195 } ) ;
175196
176197 it ( "video DOM src should be set initially" , ( ) => {
198+ component . urlEndpoint = "https://ik.imagekit.io/example" ;
177199 component . src = "https://ik.imagekit.io/demo/sample-video.mp4" ;
178200 fixture . detectChanges ( ) ;
179201 const ikImageElement : HTMLElement = fixture . nativeElement ;
0 commit comments