Add tests for media streaming routes (Range, 416, HEAD, audio)

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

@Aaqibhafeezkhan is already working on this.

Since Nov 7, 2026.

  • #51 by @Aaqibhafeezkhan — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
30/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript, node.js
Domain
backend, testing

Research direction

Read test/media.test.js, media.js:21-36, and server.js:87-105; inspect the files in showcase/media/ with stat() to get expected sizes. Add createApp() tests for the listed GET, Range, HEAD, audio, and unknown-id cases, then run npm test. Done means the tests pass and a broken Content-Range in media.js:29 fails a test.

Written by the indexing model from the issue text.

Description

good first issue tests

test/media.test.js only tests byteRange(). Nothing tests streamVideo() (media.js:21-36) or the /media/references/... routes (server.js:87-105), even though seeking and the export's audio depend on them. test/server.test.js:43 checks only the 404 for an excluded reference.

Add tests against createApp() using a showcase id (for example 69614b10fa87):

  • GET .../69614b10fa87.mp4 returns 200, Accept-Ranges: bytes, and a Content-Length equal to the file size.
  • Range: bytes=0-99 returns 206, Content-Range: bytes 0-99/<size>, and a 100-byte body.
  • Range: bytes=999999999- returns 416 with Content-Range: bytes */<size>.
  • HEAD returns the headers with an empty body.
  • GET .../69614b10fa87.aac returns 200 with audio/aac.
  • An unknown id such as .../nope.mp4 returns 404.

Get the expected sizes from stat() on the files in showcase/media/, not hard-coded numbers.

Done when the new tests pass with npm test, and breaking Content-Range in media.js:29 makes one of them fail.

Dominant language
HTML
Stars
1.2k
Forks
109
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from blixvip/NullMotion

All issues in blixvip/NullMotion

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.