-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: also accept number as size argument
- Loading branch information
Showing
3 changed files
with
35 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import mediaInfoFactory from '..' | ||
import { expectToBeDefined } from './utils' | ||
import type { MediaInfo, SizeArg } from '..' | ||
|
||
it.each([ | ||
['number', 20], | ||
['function', () => 20], | ||
['async function', () => Promise.resolve(20)], | ||
])('should accept %s as size arg', async (_: string, size: SizeArg) => { | ||
let mi: MediaInfo | undefined | ||
|
||
try { | ||
mi = await mediaInfoFactory() | ||
const result = await mi.analyzeData(size, () => new Uint8Array(10)) | ||
expectToBeDefined(result.media) | ||
const { track } = result.media | ||
expect(track).toHaveLength(1) | ||
expect(track[0].FileSize).toBe('20') | ||
} finally { | ||
if (mi) { | ||
mi.close() | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters