Skip to content

The swiss army knife of lossless video/audio editing

Use toStrictEqual in tests (vitest/prefer-strict-equal)

Clauded8827022689a
diff --git a/.oxlintrc.json b/.oxlintrc.json
index 37970120..78c3fcfd 100644
--- a/.oxlintrc.json
+++ b/.oxlintrc.json
@@ -29,8 +29,6 @@
// TODO stage 2 rules from @mifi/lint-config with many findings here (count in parentheses), turned off until fixed
"unicorn-js/consistent-boolean-name": "off", // (95)
"react/exhaustive-effect-dependencies": "off", // (81)
- "typescript/strict-void-return": "off", // (144)
- "vitest/prefer-strict-equal": "off", // (75)
"typescript/promise-function-async": "off", // (50)
"react/only-export-components": "off", // (48)
"no-implicit-coercion": "off", // (25)
diff --git a/src/main/ffmpegUtil.test.ts b/src/main/ffmpegUtil.test.ts
index 06ac286f..42c8a1c3 100644
--- a/src/main/ffmpegUtil.test.ts
+++ b/src/main/ffmpegUtil.test.ts
@@ -27,10 +27,10 @@ describe('getFfmpegJpegQuality', () => {
describe('parseBlackDetectLine', () => {
test('macOS and Linux', () => {
- expect(parseBlackDetectLine('[Parsed_blackdetect_0 @ 0x5581e0c2e540] black_start:3.5 black_end:5 black_duration:1.5')).toEqual({ start: 3.5, end: 5 });
+ expect(parseBlackDetectLine('[Parsed_blackdetect_0 @ 0x5581e0c2e540] black_start:3.5 black_end:5 black_duration:1.5')).toStrictEqual({ start: 3.5, end: 5 });
});
test('Windows (no 0x)', () => {
- expect(parseBlackDetectLine('[Parsed_blackdetect_0 @ 00000244af592040] black_start:0 black_end:2.04 black_duration:2.04')).toEqual({ start: 0, end: 2.04 });
+ expect(parseBlackDetectLine('[Parsed_blackdetect_0 @ 00000244af592040] black_start:0 black_end:2.04 black_duration:2.04')).toStrictEqual({ start: 0, end: 2.04 });
});
test('other lines', () => {
expect(parseBlackDetectLine('[Parsed_blackdetect_0 @ 0x5581e0c2e540] something else')).toBeUndefined();
@@ -40,14 +40,14 @@ describe('parseBlackDetectLine', () => {
describe('parseSilenceDetectLine', () => {
test('macOS and Linux', () => {
- expect(parseSilenceDetectLine('[Parsed_silencedetect_0 @ 0x5581e0c2e540] silence_end: 10 | silence_duration: 2.5')).toEqual({ start: 7.5, end: 10 });
+ expect(parseSilenceDetectLine('[Parsed_silencedetect_0 @ 0x5581e0c2e540] silence_end: 10 | silence_duration: 2.5')).toStrictEqual({ start: 7.5, end: 10 });
});
test('Windows (no 0x)', () => {
- expect(parseSilenceDetectLine('[Parsed_silencedetect_0 @ 00000244af592040] silence_end: 3.5 | silence_duration: 1.5')).toEqual({ start: 2, end: 3.5 });
- expect(parseSilenceDetectLine('[Parsed_silencedetect_0 @ 00000244AF592040] silence_end: 3.5 | silence_duration: 1.5')).toEqual({ start: 2, end: 3.5 });
+ expect(parseSilenceDetectLine('[Parsed_silencedetect_0 @ 00000244af592040] silence_end: 3.5 | silence_duration: 1.5')).toStrictEqual({ start: 2, end: 3.5 });
+ expect(parseSilenceDetectLine('[Parsed_silencedetect_0 @ 00000244AF592040] silence_end: 3.5 | silence_duration: 1.5')).toStrictEqual({ start: 2, end: 3.5 });
});
test('slightly negative start is clamped to 0', () => {
- expect(parseSilenceDetectLine('[Parsed_silencedetect_1 @ 0x5581e0c2e540] silence_end: 1.522268 | silence_duration: 1.522426')).toEqual({ start: 0, end: 1.522268 });
+ expect(parseSilenceDetectLine('[Parsed_silencedetect_1 @ 0x5581e0c2e540] silence_end: 1.522268 | silence_duration: 1.522426')).toStrictEqual({ start: 0, end: 1.522268 });
});
test('silence_start line is ignored', () => {
expect(parseSilenceDetectLine('[Parsed_silencedetect_0 @ 0x5581e0c2e540] silence_start: 7.5')).toBeUndefined();
diff --git a/src/main/util.test.ts b/src/main/util.test.ts
index 11e6cc9a..bfc53f02 100644
--- a/src/main/util.test.ts
+++ b/src/main/util.test.ts
@@ -9,24 +9,24 @@ const cwd = resolve('/home/user/videos');
describe('resolveCliFileArgs', () => {
test('resolves relative file args against the given cwd (#1571)', () => {
- expect(resolveCliFileArgs(['video.mp4', 'clips/a.mkv'], cwd)).toEqual([join(cwd, 'video.mp4'), join(cwd, 'clips', 'a.mkv')]);
+ expect(resolveCliFileArgs(['video.mp4', 'clips/a.mkv'], cwd)).toStrictEqual([join(cwd, 'video.mp4'), join(cwd, 'clips', 'a.mkv')]);
});
test('leaves absolute file args untouched (no normalization, e.g. through symlinks)', () => {
const absolute = [resolve('/media/link'), '..', 'a.mp4'].join(sep);
- expect(resolveCliFileArgs([absolute], cwd)).toEqual([absolute]);
+ expect(resolveCliFileArgs([absolute], cwd)).toStrictEqual([absolute]);
});
});
describe('parseCliKeyboardActionArgs', () => {
test('resolves openFiles paths against the given cwd', () => {
- expect(parseCliKeyboardActionArgs('openFiles', ['["video.mp4"]'], cwd)).toEqual([[join(cwd, 'video.mp4')]]);
+ expect(parseCliKeyboardActionArgs('openFiles', ['["video.mp4"]'], cwd)).toStrictEqual([[join(cwd, 'video.mp4')]]);
});
test('parses JSON and JSON5, leaving other actions and malformed openFiles args untouched', () => {
- expect(parseCliKeyboardActionArgs('goToTimecodeDirect', ['{"time": "12.23"}'], cwd)).toEqual([{ time: '12.23' }]);
- expect(parseCliKeyboardActionArgs('goToTimecodeDirect', ['{time: "12.23"}'], cwd)).toEqual([{ time: '12.23' }]);
- expect(parseCliKeyboardActionArgs('openFiles', ['"video.mp4"'], cwd)).toEqual(['video.mp4']);
+ expect(parseCliKeyboardActionArgs('goToTimecodeDirect', ['{"time": "12.23"}'], cwd)).toStrictEqual([{ time: '12.23' }]);
+ expect(parseCliKeyboardActionArgs('goToTimecodeDirect', ['{time: "12.23"}'], cwd)).toStrictEqual([{ time: '12.23' }]);
+ expect(parseCliKeyboardActionArgs('openFiles', ['"video.mp4"'], cwd)).toStrictEqual(['video.mp4']);
});
test('throws on invalid JSON5', () => {
diff --git a/src/renderer/src/edlFormats.test.ts b/src/renderer/src/edlFormats.test.ts
index 97db2d61..42e29704 100644
--- a/src/renderer/src/edlFormats.test.ts
+++ b/src/renderer/src/edlFormats.test.ts
@@ -46,13 +46,13 @@ describe('parseYouTube', () => {
6.01 6.01 label
`;
const edl = parseYouTube(str);
- expect(edl).toEqual(expectYouTube1);
+ expect(edl).toStrictEqual(expectYouTube1);
});
it('eol', () => {
const str = ' 00:00 Test 1\n00:01 Test 2';
const edl = parseYouTube(str);
- expect(edl).toEqual([
+ expect(edl).toStrictEqual([
{ start: 0, end: 1, name: 'Test 1' },
{ start: 1, end: undefined, name: 'Test 2' },
]);
@@ -61,7 +61,7 @@ describe('parseYouTube', () => {
it('colon after time', () => {
const str = ' 00:00: Test 1';
const edl = parseYouTube(str);
- expect(edl).toEqual([
+ expect(edl).toStrictEqual([
{ start: 0, end: undefined, name: 'Test 1' },
]);
});
@@ -70,7 +70,7 @@ describe('parseYouTube', () => {
it('Windows crlf', () => {
const str = ' 00:00: Test 1\r\n00:01: Test 2';
const edl = parseYouTube(str);
- expect(edl).toEqual([
+ expect(edl).toStrictEqual([
{ start: 0, end: 1, name: 'Test 1' },
{ start: 1, end: undefined, name: 'Test 2' },
]);
@@ -82,20 +82,20 @@ it('formatYouTube', () => {
{ start: 1, name: 'Label πŸŽ‰' },
{ start: 3 },
{ start: 10000, name: '' },
- ]).split('\n')).toEqual([
+ ]).split('\n')).toStrictEqual([
'0:01 Label πŸŽ‰',
'0:03',
'2:46:40',
]);
expect(formatYouTube([
{ start: 0 },
- ]).split('\n')).toEqual([
+ ]).split('\n')).toStrictEqual([
'0:00',
]);
});
it('formatYouTube 2', () => {
- expect(formatYouTube(expectYouTube1).split('\n')).toEqual([
+ expect(formatYouTube(expectYouTube1).split('\n')).toStrictEqual([
'0:00 00:01 Test 1',
'0:01 "Test 2":',
'0:02 00:57 double',
@@ -136,7 +136,7 @@ it('parseMplayerEdl', async () => {
const str = await readFixture('mplayer.edl');
- expect(await parseMplayerEdl(str)).toEqual([
+ expect(await parseMplayerEdl(str)).toStrictEqual([
{ start: 0,
end: 5.3,
name: 'Cut',
@@ -171,7 +171,7 @@ it('parseMplayerEdl', async () => {
it('parseMplayerEdl, starting at 0', async () => {
const str2 = ' 0 1.1 0\n';
- expect(await parseMplayerEdl(str2)).toEqual([{
+ expect(await parseMplayerEdl(str2)).toStrictEqual([{
start: 1.1,
end: undefined,
name: 'Cut',
@@ -216,7 +216,7 @@ it('parses xmeml with single clipitem', () => {
</media>
</sequence>
</xmeml>`;
- expect(parseXmeml(xml)).toEqual([{ start: 1, end: 3 }]);
+ expect(parseXmeml(xml)).toStrictEqual([{ start: 1, end: 3 }]);
});
it('parses fcpxml with single asset-clip, whole second times and missing start', () => {
@@ -232,8 +232,8 @@ it('parses fcpxml with single asset-clip, whole second times and missing start',
</event>
</library>
</fcpxml>`;
- expect(parseFcpXml(getXml('<asset-clip offset="0s" name="Single" start="10/2s" duration="20/2s"/>'))).toEqual([{ start: 5, end: 15 }]);
- expect(parseFcpXml(getXml('<asset-clip offset="0s" start="0s" duration="10s"/><asset-clip offset="10s" duration="2.5s"/>'))).toEqual([{ start: 0, end: 10 }, { start: 0, end: 2.5 }]);
+ expect(parseFcpXml(getXml('<asset-clip offset="0s" name="Single" start="10/2s" duration="20/2s"/>'))).toStrictEqual([{ start: 5, end: 15 }]);
+ expect(parseFcpXml(getXml('<asset-clip offset="0s" start="0s" duration="10s"/><asset-clip offset="10s" duration="2.5s"/>'))).toStrictEqual([{ start: 0, end: 10 }, { start: 0, end: 2.5 }]);
});
// https://github.com/mifi/lossless-cut/issues/1024
@@ -248,7 +248,7 @@ it('parses csv with frames', () => {
const fps = 30;
const parsed = parseCsv(csvFramesStr, getFrameValParser(fps));
- expect(parsed).toEqual([
+ expect(parsed).toStrictEqual([
{ end: 5.166666666666667, name: 'EP106_SQ010_SH0010', start: 0 },
{ end: 8.366666666666667, name: 'EP106_SQ010_SH0020', start: 5.2 },
{ end: 22.9, name: 'EP106_SQ010_SH0030', start: 8.4 },
@@ -274,7 +274,7 @@ const csvTimestampStr = `\
it('parses csv with timestamps', () => {
const parsed = parseCsv(csvTimestampStr, parseCsvTime);
- expect(parsed).toEqual([
+ expect(parsed).toStrictEqual([
{ end: 189.053, name: 'A', start: 114.612 },
{ end: 476.194, name: 'B', start: 300.448 },
{ end: 704.264, name: 'C', start: 567.075 },
@@ -287,7 +287,7 @@ it('parses csv with timestamps', () => {
it('parses csv with 2 columns (no name)', () => {
const parsed = parseCsv('1,2\n3,4\n', parseCsvTime);
- expect(parsed).toEqual([
+ expect(parsed).toStrictEqual([
{ start: 1, end: 2 },
{ start: 3, end: 4 },
]);
@@ -295,7 +295,7 @@ it('parses csv with 2 columns (no name)', () => {
it('parses csv with 1 column (markers)', () => {
const parsed = parseCsv('1\n2\n3\n', parseCsvTime);
- expect(parsed).toEqual([
+ expect(parsed).toStrictEqual([
{ start: 1 },
{ start: 2 },
{ start: 3 },
@@ -312,7 +312,7 @@ it('parses csv with tags', () => {
const csv = `${csvWithTagsHeader}\n${csvWithTags}\n`;
const parsed = parseCsv(csv, parseCsvTime);
- expect(parsed).toEqual([
+ expect(parsed).toStrictEqual([
{ start: 1, end: 2, name: 'Name1', tags: { group: 'group1', Name: 'This is a tag which is also called Name' } },
{ start: 3, end: 4, name: 'Name2', tags: { Name: 'Name' } },
{ start: 5, end: 6, name: 'Name3', tags: { group: 'Group 2' } },
@@ -321,7 +321,7 @@ it('parses csv with tags', () => {
it('parses csv with tags but no header', () => {
const parsed = parseCsv(csvWithTags, parseCsvTime);
- expect(parsed).toEqual([
+ expect(parsed).toStrictEqual([
{ start: 1, end: 2, name: 'Name1', tags: { tag1: 'group1', tag2: 'This is a tag which is also called Name' } },
{ start: 3, end: 4, name: 'Name2', tags: { tag2: 'Name' } },
{ start: 5, end: 6, name: 'Name3', tags: { tag1: 'Group 2' } },
@@ -378,7 +378,7 @@ GeneratedBy=cutlist v0.0.0
it('parses cutlist', async () => {
const parsed = await parseCutlist(cutlistStr);
- expect(parsed).toEqual([
+ expect(parsed).toStrictEqual([
{ end: 2730.96, name: 'Cut 0', start: 849.12 },
{ end: 4092.32, name: 'Cut 1', start: 3147.72 },
]);
diff --git a/src/renderer/src/segments.test.ts b/src/renderer/src/segments.test.ts
index 35be671a..daf8da09 100644
--- a/src/renderer/src/segments.test.ts
+++ b/src/renderer/src/segments.test.ts
@@ -55,18 +55,18 @@ it('converts segments to chapters with single long segment', () => {
it('detects overlapping segments', () => {
expect(partitionIntoOverlappingRanges([
{ start: 0, end: 1 },
- ])).toEqual([]);
+ ])).toStrictEqual([]);
expect(partitionIntoOverlappingRanges([
{ start: 0, end: 1 },
{ start: 1, end: 2 },
- ])).toEqual([]);
+ ])).toStrictEqual([]);
expect(partitionIntoOverlappingRanges([
{ start: 0, end: 1 },
{ start: 0.5, end: 2 },
{ start: 2, end: 3 },
- ])).toEqual([
+ ])).toStrictEqual([
[
{ start: 0, end: 1 },
{ start: 0.5, end: 2 },
@@ -76,7 +76,7 @@ it('detects overlapping segments', () => {
expect(partitionIntoOverlappingRanges([
{ start: 0, end: 2 },
{ start: 0.5, end: 1 },
- ])).toEqual([
+ ])).toStrictEqual([
[
{ start: 0, end: 2 },
{ start: 0.5, end: 1 },
@@ -95,7 +95,7 @@ it('detects overlapping segments', () => {
{ start: 19, end: 19.5 },
{ start: 19.5, end: 22 },
{ start: 22, end: 25 },
- ])).toEqual([
+ ])).toStrictEqual([
[{ start: 11, end: 12 }, { start: 11.5, end: 13 }, { start: 11.5, end: 12.5 }],
[{ start: 17, end: 20 }, { start: 17.5, end: 18.5 }, { start: 18, end: 19.5 }, { start: 19, end: 19.5 }, { start: 19.5, end: 22 }],
]);
@@ -105,7 +105,7 @@ it('detects overlapping segments, undefined end', () => {
expect(partitionIntoOverlappingRanges([
{ start: 1, end: undefined },
{ start: 1.5, end: undefined },
- ])).toEqual([]);
+ ])).toStrictEqual([]);
});
test('formatSegNum', () => {
diff --git a/src/renderer/src/timelineWheel.test.ts b/src/renderer/src/timelineWheel.test.ts
index 17bb714d..f21e689c 100644
--- a/src/renderer/src/timelineWheel.test.ts
+++ b/src/renderer/src/timelineWheel.test.ts
@@ -31,50 +31,50 @@ function getAction({ pixelX = 0, pixelY = 0, modifiers = {}, isPinch = false, in
// deltaY < 0 means wheel up (or trackpad pinch out)
describe('zoom', () => {
test.each([false, true])('ctrl+wheel up zooms in, down zooms out, regardless of invertTimelineScroll=%s', (invertTimelineScroll) => {
- expect(getAction({ pixelY: -100, modifiers: { ctrlKey: true }, invertTimelineScroll })).toEqual({ type: 'zoom', amount: 40 });
- expect(getAction({ pixelY: 100, modifiers: { ctrlKey: true }, invertTimelineScroll })).toEqual({ type: 'zoom', amount: -40 });
+ expect(getAction({ pixelY: -100, modifiers: { ctrlKey: true }, invertTimelineScroll })).toStrictEqual({ type: 'zoom', amount: 40 });
+ expect(getAction({ pixelY: 100, modifiers: { ctrlKey: true }, invertTimelineScroll })).toStrictEqual({ type: 'zoom', amount: -40 });
});
test('custom zoom modifier', () => {
- expect(getAction({ pixelY: -100, modifiers: { metaKey: true }, zoomKey: 'meta' })).toEqual({ type: 'zoom', amount: 40 });
+ expect(getAction({ pixelY: -100, modifiers: { metaKey: true }, zoomKey: 'meta' })).toStrictEqual({ type: 'zoom', amount: 40 });
});
test('trackpad pinch zooms with higher sensitivity, also if zoom modifier is not ctrl', () => {
- expect(getAction({ pixelY: -10, modifiers: { ctrlKey: true }, isPinch: true })).toEqual({ type: 'zoom', amount: 20 });
- expect(getAction({ pixelY: -10, modifiers: { ctrlKey: true }, isPinch: true, zoomKey: 'meta', frameSeekKey: 'ctrl' })).toEqual({ type: 'zoom', amount: 20 });
+ expect(getAction({ pixelY: -10, modifiers: { ctrlKey: true }, isPinch: true })).toStrictEqual({ type: 'zoom', amount: 20 });
+ expect(getAction({ pixelY: -10, modifiers: { ctrlKey: true }, isPinch: true, zoomKey: 'meta', frameSeekKey: 'ctrl' })).toStrictEqual({ type: 'zoom', amount: 20 });
});
test('ctrl actually held with other zoom modifier seeks, as before', () => {
- expect(getAction({ pixelY: -100, modifiers: { ctrlKey: true }, zoomKey: 'meta' })).toEqual({ type: 'seek', amount: 20 });
- expect(getAction({ pixelY: -100, modifiers: { ctrlKey: true }, zoomKey: 'meta', frameSeekKey: 'ctrl' })).toEqual({ type: 'frameSeek', direction: 1 });
+ expect(getAction({ pixelY: -100, modifiers: { ctrlKey: true }, zoomKey: 'meta' })).toStrictEqual({ type: 'seek', amount: 20 });
+ expect(getAction({ pixelY: -100, modifiers: { ctrlKey: true }, zoomKey: 'meta', frameSeekKey: 'ctrl' })).toStrictEqual({ type: 'frameSeek', direction: 1 });
});
test('horizontal scroll with ctrl does not zoom', () => {
- expect(getAction({ pixelX: 30, modifiers: { ctrlKey: true } })).toEqual({ type: 'none' });
- expect(getAction({ pixelX: 30, modifiers: { ctrlKey: true, shiftKey: true } })).toEqual({ type: 'none' });
+ expect(getAction({ pixelX: 30, modifiers: { ctrlKey: true } })).toStrictEqual({ type: 'none' });
+ expect(getAction({ pixelX: 30, modifiers: { ctrlKey: true, shiftKey: true } })).toStrictEqual({ type: 'none' });
});
test('shift as zoom modifier, where shift+wheel arrives as horizontal scroll', () => {
- expect(getAction({ pixelX: -100, modifiers: { shiftKey: true }, zoomKey: 'shift', keyframeSeekKey: 'meta' })).toEqual({ type: 'zoom', amount: 40 });
+ expect(getAction({ pixelX: -100, modifiers: { shiftKey: true }, zoomKey: 'shift', keyframeSeekKey: 'meta' })).toStrictEqual({ type: 'zoom', amount: 40 });
});
});
describe('seek', () => {
test('wheel up seeks forward, inverted with invertTimelineScroll', () => {
- expect(getAction({ pixelY: -100 })).toEqual({ type: 'seek', amount: 20 });
- expect(getAction({ pixelY: -100, invertTimelineScroll: true })).toEqual({ type: 'seek', amount: -20 });
+ expect(getAction({ pixelY: -100 })).toStrictEqual({ type: 'seek', amount: 20 });
+ expect(getAction({ pixelY: -100, invertTimelineScroll: true })).toStrictEqual({ type: 'seek', amount: -20 });
});
test('frame and keyframe seek follow invertTimelineScroll', () => {
- expect(getAction({ pixelY: -100, modifiers: { altKey: true } })).toEqual({ type: 'frameSeek', direction: 1 });
- expect(getAction({ pixelY: -100, modifiers: { altKey: true }, invertTimelineScroll: true })).toEqual({ type: 'frameSeek', direction: -1 });
- expect(getAction({ pixelX: -100, modifiers: { shiftKey: true } })).toEqual({ type: 'keyframeSeek', direction: 1 });
- expect(getAction({ pixelX: -100, modifiers: { shiftKey: true }, invertTimelineScroll: true })).toEqual({ type: 'keyframeSeek', direction: -1 });
+ expect(getAction({ pixelY: -100, modifiers: { altKey: true } })).toStrictEqual({ type: 'frameSeek', direction: 1 });
+ expect(getAction({ pixelY: -100, modifiers: { altKey: true }, invertTimelineScroll: true })).toStrictEqual({ type: 'frameSeek', direction: -1 });
+ expect(getAction({ pixelX: -100, modifiers: { shiftKey: true } })).toStrictEqual({ type: 'keyframeSeek', direction: 1 });
+ expect(getAction({ pixelX: -100, modifiers: { shiftKey: true }, invertTimelineScroll: true })).toStrictEqual({ type: 'keyframeSeek', direction: -1 });
});
test('no action without any net delta', () => {
- expect(getAction({ modifiers: { altKey: true } })).toEqual({ type: 'none' });
- expect(getAction({ pixelX: 3, pixelY: -3, modifiers: { altKey: true } })).toEqual({ type: 'none' });
- expect(getAction({})).toEqual({ type: 'none' });
+ expect(getAction({ modifiers: { altKey: true } })).toStrictEqual({ type: 'none' });
+ expect(getAction({ pixelX: 3, pixelY: -3, modifiers: { altKey: true } })).toStrictEqual({ type: 'none' });
+ expect(getAction({})).toStrictEqual({ type: 'none' });
});
});
diff --git a/src/renderer/src/util/duration.test.ts b/src/renderer/src/util/duration.test.ts
index 88eee6fa..a5d68406 100644
--- a/src/renderer/src/util/duration.test.ts
+++ b/src/renderer/src/util/duration.test.ts
@@ -106,5 +106,5 @@ it.each([24, 25, 30, 60, 24000 / 1001, 30000 / 1001, 48000 / 1001, 60000 / 1001]
const roundTripped = formatDuration({ seconds: parseDuration(formatted, fps), fps });
if (roundTripped !== formatted) mismatches.push(`${formatted} -> ${roundTripped}`);
}
- expect(mismatches).toEqual([]);
+ expect(mismatches).toStrictEqual([]);
});
diff --git a/src/renderer/src/util/metadata.test.ts b/src/renderer/src/util/metadata.test.ts
index 0b95a9a9..6212d00b 100644
--- a/src/renderer/src/util/metadata.test.ts
+++ b/src/renderer/src/util/metadata.test.ts
@@ -37,10 +37,10 @@ test('needsHvc1Tag', () => {
});
test('getNonNativeMovMetadataKeys', () => {
- expect(getNonNativeMovMetadataKeys({ metadata: { title: 'a', custom: 'b', deleted: '' }, outFormat: 'mov', isStream: true })).toEqual(['custom']);
- expect(getNonNativeMovMetadataKeys({ metadata: { title: 'a' }, outFormat: 'mp4', isStream: true })).toEqual(['title']);
- expect(getNonNativeMovMetadataKeys({ metadata: { title: 'a', lyrics: 'b', custom: 'c' }, outFormat: 'mp4', isStream: false })).toEqual(['custom']);
- expect(getNonNativeMovMetadataKeys({ metadata: undefined, outFormat: 'mp4', isStream: true })).toEqual([]);
+ expect(getNonNativeMovMetadataKeys({ metadata: { title: 'a', custom: 'b', deleted: '' }, outFormat: 'mov', isStream: true })).toStrictEqual(['custom']);
+ expect(getNonNativeMovMetadataKeys({ metadata: { title: 'a' }, outFormat: 'mp4', isStream: true })).toStrictEqual(['title']);
+ expect(getNonNativeMovMetadataKeys({ metadata: { title: 'a', lyrics: 'b', custom: 'c' }, outFormat: 'mp4', isStream: false })).toStrictEqual(['custom']);
+ expect(getNonNativeMovMetadataKeys({ metadata: undefined, outFormat: 'mp4', isStream: true })).toStrictEqual([]);
});
test('isValidCreationTime', () => {
@@ -53,8 +53,8 @@ test('isValidCreationTime', () => {
});
test('getEffectiveMetadata', () => {
- expect(getEffectiveMetadata({ title: 'a', language: 'eng', comment: 'c' }, { title: 'b', comment: '' })).toEqual({ title: 'b', language: 'eng' });
- expect(getEffectiveMetadata(undefined, undefined)).toEqual({});
+ expect(getEffectiveMetadata({ title: 'a', language: 'eng', comment: 'c' }, { title: 'b', comment: '' })).toStrictEqual({ title: 'b', language: 'eng' });
+ expect(getEffectiveMetadata(undefined, undefined)).toStrictEqual({});
});
test('getCopyableMetadata', () => {
@@ -70,7 +70,7 @@ test('getCopyableMetadata', () => {
iTunSMPB: ' 00000000 00000840',
creation_time: '2024-01-01T00:00:00.000000Z',
filename: 'font.ttf',
- })).toEqual({ title: 'a', language: 'eng' });
- expect(getCopyableMetadata({ handler_name: 'English Commentary' })).toEqual({ handler_name: 'English Commentary' });
- expect(getCopyableMetadata({ handler_name: '\u{10}DJI.Subtitle' })).toEqual({});
+ })).toStrictEqual({ title: 'a', language: 'eng' });
+ expect(getCopyableMetadata({ handler_name: 'English Commentary' })).toStrictEqual({ handler_name: 'English Commentary' });
+ expect(getCopyableMetadata({ handler_name: '\u{10}DJI.Subtitle' })).toStrictEqual({});
});
diff --git a/src/renderer/src/util/streams.test.ts b/src/renderer/src/util/streams.test.ts
index 6408123d..7f578c38 100644
--- a/src/renderer/src/util/streams.test.ts
+++ b/src/renderer/src/util/streams.test.ts
@@ -52,7 +52,7 @@ test('getMapStreamsArgs', () => {
allFilesMeta,
copyFileStreams: [{ path, streamIds: streams1.map((stream) => stream.index) }],
outFormat,
- })).toEqual([
+ })).toStrictEqual([
'-map', '0:0', '-c:0', 'copy',
'-map', '0:1', '-c:1', 'copy',
'-map', '0:2', '-c:2', 'copy',
@@ -75,7 +75,7 @@ test('getMapStreamsArgs, subtitles to matroska', () => {
allFilesMeta: { [path]: { streams } },
copyFileStreams: [{ path, streamIds: streams.map((stream) => stream.index) }],
outFormat,
- })).toEqual([
+ })).toStrictEqual([
'-map', '0:0', '-c:0', 'srt',
]);
});
@@ -88,7 +88,7 @@ test('getMapStreamsArgs, disposition', () => {
copyFileStreams: [{ path, streamIds: [0] }],
outFormat,
manuallyCopyDisposition: true,
- })).toEqual([
+ })).toStrictEqual([
'-map', '0:0',
'-c:0', 'copy',
'-disposition:0', 'attached_pic',
@@ -112,7 +112,7 @@ test('getMapStreamsArgs, smart cut', () => {
}
return undefined;
},
- })).toEqual([
+ })).toStrictEqual([
'-map', '0:1',
'-c:0', 'copy',
'-map', '0:2',
@@ -131,8 +131,8 @@ test('getMapStreamsArgs, smart cut', () => {
test('getStreamIdsToCopy, includeAllStreams false', () => {
const { streamIdsToCopy, excludedStreamIds } = getStreamIdsToCopy({ streams: streams1, includeAllStreams: false });
- expect(streamIdsToCopy).toEqual([2, 1, 7]);
- expect(excludedStreamIds).toEqual([0, 3, 4, 5, 6]);
+ expect(streamIdsToCopy).toStrictEqual([2, 1, 7]);
+ expect(excludedStreamIds).toStrictEqual([0, 3, 4, 5, 6]);
});
test('srt output', () => {
@@ -140,7 +140,7 @@ test('srt output', () => {
allFilesMeta: { [path]: { streams: [{ index: 0, codec_type: 'subtitle', codec_tag: '0x67337874', codec_name: 'mov_text', time_base: '', disposition: makeDisposition() }] } },
copyFileStreams: [{ path, streamIds: [0] }],
outFormat: 'srt',
- })).toEqual([
+ })).toStrictEqual([
'-map', '0:0', '-c:0', 'srt',
]);
});
@@ -150,7 +150,7 @@ test('webvtt output', () => {
allFilesMeta: { [path]: { streams: [{ index: 0, codec_type: 'subtitle', codec_tag: '0x67337874', codec_name: 'mov_text', time_base: '', disposition: makeDisposition() }] } },
copyFileStreams: [{ path, streamIds: [0] }],
outFormat: 'webvtt',
- })).toEqual([
+ })).toStrictEqual([
'-map', '0:0', '-c:0', 'webvtt',
]);
});
@@ -160,7 +160,7 @@ test('ass output', () => {
allFilesMeta: { [path]: { streams: [{ index: 0, codec_type: 'subtitle', codec_tag: '0x67337874', codec_name: 'mov_text', time_base: '', disposition: makeDisposition() }] } },
copyFileStreams: [{ path, streamIds: [0] }],
outFormat: 'ass',
- })).toEqual([
+ })).toStrictEqual([
'-map', '0:0', '-c:0', 'ass',
]);
});