Skip to content

Commit 1b745fe

Browse files
committed
chore: use image_url instead of img_url in tests (as img_url is deprecated)
1 parent 3814fd8 commit 1b745fe

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

projects/stream-chat-angular/src/lib/attachment-configuration.service.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('AttachmentConfigurationService', () => {
7070
const spy = jasmine.createSpy();
7171
service.customImageAttachmentConfigurationHandler = spy;
7272
const attachment: Attachment = {
73-
img_url: 'http://url/to/img',
73+
image_url: 'http://url/to/img',
7474
thumb_url: 'different/url',
7575
};
7676
const htmlElement = {
@@ -88,7 +88,7 @@ describe('AttachmentConfigurationService', () => {
8888

8989
it('should provide the correct configuration for gallery image attachments', () => {
9090
const attachment: Attachment = {
91-
img_url: 'http://url/to/img',
91+
image_url: 'http://url/to/img',
9292
};
9393
const htmlElement = {
9494
'max-width': '300px',
@@ -112,7 +112,7 @@ describe('AttachmentConfigurationService', () => {
112112

113113
it('should provide the correct configuration for image attachments inside the carousel', () => {
114114
const attachment: Attachment = {
115-
img_url: 'http://url/to/img',
115+
image_url: 'http://url/to/img',
116116
};
117117
const htmlElement = {
118118
'max-width': 'none',
@@ -191,7 +191,7 @@ describe('AttachmentConfigurationService', () => {
191191
const spy = jasmine.createSpy();
192192
service.customVideoAttachmentConfigurationHandler = spy;
193193
const attachment: Attachment = {
194-
img_url: 'http://url/to/video',
194+
image_url: 'http://url/to/video',
195195
thumb_url: 'different/url',
196196
};
197197
const htmlElement = {
@@ -348,7 +348,7 @@ describe('AttachmentConfigurationService', () => {
348348

349349
it('should provide integer values for image resize and make sure that each dimension is at least the size restriction', () => {
350350
const attachment = {
351-
img_url: 'http://url/to/img?ow=3534&oh=4417',
351+
image_url: 'http://url/to/img?ow=3534&oh=4417',
352352
};
353353
const htmlElement = {
354354
'max-width': '300px',

projects/stream-chat-angular/src/lib/attachment-list/attachment-list.component.spec.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ describe('AttachmentListComponent', () => {
142142
expect(queryAttachments().length).toBe(0);
143143

144144
component.attachments = [
145-
{ type: 'image', img_url: 'http://url1' },
145+
{ type: 'image', image_url: 'http://url1' },
146146
{ type: 'file', asset_url: 'http://url3' },
147147
{
148148
type: 'video',
@@ -264,28 +264,28 @@ describe('AttachmentListComponent', () => {
264264

265265
it('should create gallery', () => {
266266
component.attachments = [
267-
{ type: 'image', img_url: 'http://url1' },
267+
{ type: 'image', image_url: 'http://url1' },
268268
{ type: 'file', asset_url: 'http://url3' },
269-
{ type: 'image', img_url: 'http://url2' },
269+
{ type: 'image', image_url: 'http://url2' },
270270
];
271271
component.ngOnChanges({ attachments: {} as SimpleChange });
272272
fixture.detectChanges();
273273
const orderedAttachments = component.orderedAttachments;
274274

275275
expect(orderedAttachments.length).toBe(2);
276276
expect(orderedAttachments[0].type).toBe('gallery');
277-
expect((orderedAttachments[0] as GalleryAttachment).images[0].img_url).toBe(
278-
'http://url1'
279-
);
280-
expect((orderedAttachments[0] as GalleryAttachment).images[1].img_url).toBe(
281-
'http://url2'
282-
);
277+
expect(
278+
(orderedAttachments[0] as GalleryAttachment).images[0].image_url
279+
).toBe('http://url1');
280+
expect(
281+
(orderedAttachments[0] as GalleryAttachment).images[1].image_url
282+
).toBe('http://url2');
283283
});
284284

285285
it('should display gallery', () => {
286286
component.attachments = [
287-
{ type: 'image', img_url: 'http://url1' },
288-
{ type: 'image', img_url: 'http://url2' },
287+
{ type: 'image', image_url: 'http://url1' },
288+
{ type: 'image', image_url: 'http://url2' },
289289
];
290290
component.ngOnChanges({ attachments: {} as SimpleChange });
291291
fixture.detectChanges();
@@ -300,8 +300,8 @@ describe('AttachmentListComponent', () => {
300300
).toBeNull();
301301

302302
component.attachments = [
303-
{ type: 'image', img_url: 'http://url1' },
304-
{ type: 'image', img_url: 'http://url2' },
303+
{ type: 'image', image_url: 'http://url1' },
304+
{ type: 'image', image_url: 'http://url2' },
305305
{ type: 'image', thumb_url: 'http://url3' },
306306
{ type: 'image', image_url: 'http://url4' },
307307
];
@@ -320,8 +320,8 @@ describe('AttachmentListComponent', () => {
320320
).not.toBeNull();
321321

322322
component.attachments = [
323-
{ type: 'image', img_url: 'http://url1' },
324-
{ type: 'image', img_url: 'http://url2' },
323+
{ type: 'image', image_url: 'http://url1' },
324+
{ type: 'image', image_url: 'http://url2' },
325325
{ type: 'image', thumb_url: 'http://url3' },
326326
{ type: 'image', image_url: 'http://url4' },
327327
{ type: 'image', image_url: 'http://url5' },
@@ -471,7 +471,7 @@ describe('AttachmentListComponent', () => {
471471
it('should display image by thumb_url', () => {
472472
const thumbUrl = 'http://thumb/url';
473473
component.attachments = [
474-
{ type: 'image', img_url: undefined, thumb_url: thumbUrl },
474+
{ type: 'image', image_url: undefined, thumb_url: thumbUrl },
475475
];
476476
component.ngOnChanges({ attachments: {} as SimpleChange });
477477
fixture.detectChanges();
@@ -498,7 +498,7 @@ describe('AttachmentListComponent', () => {
498498
it('should set alt text for image', () => {
499499
const fallback = 'Fallback is image can not be displayed';
500500
component.attachments = [
501-
{ type: 'image', img_url: 'http://url1', fallback },
501+
{ type: 'image', image_url: 'http://url1', fallback },
502502
];
503503
component.ngOnChanges({ attachments: {} as SimpleChange });
504504
fixture.detectChanges();
@@ -508,7 +508,7 @@ describe('AttachmentListComponent', () => {
508508

509509
it('should display add necessary CSS class for SVG images', () => {
510510
component.attachments = [
511-
{ type: 'image', img_url: 'http://image/url', fallback: 'image.svg' },
511+
{ type: 'image', image_url: 'http://image/url', fallback: 'image.svg' },
512512
];
513513
component.ngOnChanges({ attachments: {} as SimpleChange });
514514
fixture.detectChanges();
@@ -518,7 +518,7 @@ describe('AttachmentListComponent', () => {
518518
).not.toBeNull();
519519

520520
component.attachments = [
521-
{ type: 'image', img_url: 'http://image/url', fallback: 'image.jpg' },
521+
{ type: 'image', image_url: 'http://image/url', fallback: 'image.jpg' },
522522
];
523523
component.ngOnChanges({ attachments: {} as SimpleChange });
524524
fixture.detectChanges();
@@ -797,7 +797,7 @@ describe('AttachmentListComponent', () => {
797797
},
798798
{
799799
type: 'image',
800-
img_url: 'http://url2',
800+
image_url: 'http://url2',
801801
},
802802
];
803803
component.attachments = attachments;
@@ -826,7 +826,7 @@ describe('AttachmentListComponent', () => {
826826
},
827827
{
828828
type: 'image',
829-
img_url: 'http://url2',
829+
image_url: 'http://url2',
830830
},
831831
];
832832
component.attachments = attachments;
@@ -855,7 +855,7 @@ describe('AttachmentListComponent', () => {
855855
},
856856
{
857857
type: 'image',
858-
img_url: 'http://url2',
858+
image_url: 'http://url2',
859859
},
860860
{
861861
type: 'image',
@@ -879,7 +879,7 @@ describe('AttachmentListComponent', () => {
879879
queryImageModalNextButton()?.click();
880880
fixture.detectChanges();
881881

882-
expect(queryImageModalImage()?.src).toContain(attachments[1].img_url!);
882+
expect(queryImageModalImage()?.src).toContain(attachments[1].image_url!);
883883
expect(queryImageModalPrevButton()?.style.visibility).toBe('visible');
884884
expect(queryImageModalNextButton()?.style.visibility).toBe('visible');
885885

@@ -964,7 +964,7 @@ describe('AttachmentListComponent', () => {
964964

965965
// Single image, link image, video, giphy
966966
component.attachments = [
967-
{ type: 'image', img_url: 'http://url1' },
967+
{ type: 'image', image_url: 'http://url1' },
968968
{
969969
title: 'BBC - Homepage',
970970
title_link: 'https://www.bbc.com/',
@@ -1016,11 +1016,11 @@ describe('AttachmentListComponent', () => {
10161016

10171017
// Gallery
10181018
component.attachments = [
1019-
{ type: 'image', img_url: 'http://url1' },
1020-
{ type: 'image', img_url: 'http://url2' },
1021-
{ type: 'image', img_url: 'http://url3' },
1022-
{ type: 'image', img_url: 'http://url4' },
1023-
{ type: 'image', img_url: 'http://url5' },
1019+
{ type: 'image', image_url: 'http://url1' },
1020+
{ type: 'image', image_url: 'http://url2' },
1021+
{ type: 'image', image_url: 'http://url3' },
1022+
{ type: 'image', image_url: 'http://url4' },
1023+
{ type: 'image', image_url: 'http://url5' },
10241024
];
10251025
component.ngOnChanges({ attachments: {} as SimpleChange });
10261026
fixture.detectChanges();

projects/stream-chat-angular/src/lib/message-input/message-input.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ describe('MessageInputComponent', () => {
576576
attachmentService.mapToAttachments.and.returnValue([
577577
{
578578
type: 'image',
579-
img_url: 'url',
579+
image_url: 'url',
580580
},
581581
]);
582582
const textarea = queryTextarea();

0 commit comments

Comments
 (0)