Skip to content

🎥 Make videos programmatically with React

improved tests and removed test smells

Tobias Boner641fd3585afe
diff --git a/packages/core/src/test/codec.test.ts b/packages/core/src/test/codec.test.ts
index 02c8498224..ed7e22e122 100644
--- a/packages/core/src/test/codec.test.ts
+++ b/packages/core/src/test/codec.test.ts
@@ -8,8 +8,8 @@ import {
// getFinalOutputCodec
test('Codec tests valid codec input', () => {
- const values: CodecOrUndefined[] = ['h264', 'h265', 'vp8', 'vp9'];
- values.forEach((entry) =>
+ const validCodecInput: CodecOrUndefined[] = ['h264', 'h265', 'vp8', 'vp9'];
+ validCodecInput.forEach((entry) =>
expect(
getFinalOutputCodec({codec: entry, emitWarning: false, fileExtension: ''})
).toEqual(entry)
@@ -34,27 +34,29 @@ test('Codec tests undefined codec input with known extension', () => {
});
test('Codec tests undefined codec input with unknown extension', () => {
- expect(
- getFinalOutputCodec({
- codec: undefined,
- emitWarning: false,
- fileExtension: '',
- })
- ).toEqual('h264');
- expect(
- getFinalOutputCodec({
- codec: undefined,
- emitWarning: false,
- fileExtension: 'abc',
- })
- ).toEqual('h264');
+ const unknownExtensions = ['', 'abc'];
+ unknownExtensions.forEach((entry) => {
+ expect(
+ getFinalOutputCodec({
+ codec: undefined,
+ emitWarning: false,
+ fileExtension: entry,
+ })
+ ).toEqual('h264');
+ });
});
// setCodec
test('Codec tests setOutputFormat', () => {
- const values: CodecOrUndefined[] = ['h264', 'h265', 'vp8', 'vp9', undefined];
- values.forEach((entry) => {
+ const validCodecInputs: CodecOrUndefined[] = [
+ 'h264',
+ 'h265',
+ 'vp8',
+ 'vp9',
+ undefined,
+ ];
+ validCodecInputs.forEach((entry) => {
setCodec(entry);
expect(getOutputCodecOrUndefined()).toEqual(entry);
});