Skip to content

Commit 3c4d222

Browse files
committed
chore: add more tests
1 parent 0051d83 commit 3c4d222

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

packages/excel-builder-vanilla/src/__tests__/excel-builder.spec.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,15 @@ describe('Excel-Builder-Vanilla', () => {
10301030
test('Drawings', async () => {
10311031
const fruitWorkbook = createWorkbook();
10321032
const berryList = fruitWorkbook.createWorksheet({ name: 'Berry List' });
1033-
const picRef = fruitWorkbook.addMedia('image', 'text.txt', new Blob());
1033+
const picRef1 = fruitWorkbook.addMedia('image', 'file1.jpeg', new Blob());
1034+
const picRef2 = fruitWorkbook.addMedia('image', 'file2.gif', new Blob());
1035+
const picRef3 = fruitWorkbook.addMedia('image', 'file3.png', new Blob(), 'image/png');
1036+
const picRef4 = fruitWorkbook.addMedia('image', 'file4.txt', new Blob());
1037+
1038+
expect(picRef1.contentType).toBe('image/jpeg');
1039+
expect(picRef2.contentType).toBe('image/gif');
1040+
expect(picRef3.contentType).toBe('image/png');
1041+
expect(picRef4.contentType).toBe(null);
10341042

10351043
const drawings = new Drawings();
10361044
const strawberryPicture1 = new Picture();
@@ -1045,7 +1053,7 @@ describe('Excel-Builder-Vanilla', () => {
10451053
},
10461054
});
10471055

1048-
strawberryPicture1.setMedia(picRef);
1056+
strawberryPicture1.setMedia(picRef1);
10491057
drawings.addDrawing(strawberryPicture1);
10501058

10511059
const strawberryPicture2 = new Picture();
@@ -1056,7 +1064,7 @@ describe('Excel-Builder-Vanilla', () => {
10561064
height: Positioning.pixelsToEMUs(300),
10571065
});
10581066

1059-
strawberryPicture2.setMedia(picRef);
1067+
strawberryPicture2.setMedia(picRef1);
10601068
drawings.addDrawing(strawberryPicture2);
10611069

10621070
const strawberryPicture3 = new Picture();
@@ -1067,7 +1075,7 @@ describe('Excel-Builder-Vanilla', () => {
10671075
height: Positioning.pixelsToEMUs(300),
10681076
});
10691077

1070-
strawberryPicture3.setMedia(picRef);
1078+
strawberryPicture3.setMedia(picRef1);
10711079
drawings.addDrawing(strawberryPicture3);
10721080

10731081
berryList.addDrawings(drawings);

0 commit comments

Comments
 (0)