Test the device table's notes and its sort order

Open Beginner friendly
#34 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Read scripts/devices/table.test.mjs and scripts/devices/fixtures/good-report.json, then inspect how the existing faster() helper builds reports and how renderTable() is called. Add tests for the specified notes and sort order, leaving table.mjs and the fixture unchanged. Run node --test scripts/devices/table.test.mjs and pnpm test; done when the new tests pass and each test has been shown to fail after breaking an expectation.

Written by the indexing model from the issue text.

Description

agent-friendly good first issue

Why

scripts/devices/table.mjs builds the device table in docs/devices.md from Device lab reports, and some of its notes and its tie-breaks have no test yet. Those rows matter as reports arrive (ROADMAP.md, Now: the Device lab).

What to do

Today scripts/devices/table.test.mjs covers "battery saver on" and "paused once for heat". Add tests there, building made-up reports from scripts/devices/fixtures/good-report.json the way its faster() helper does, and passing them to renderTable():

  1. Notes: device.lowRam: true shows "low-RAM device"; run.thermalPauses: 3 shows "paused 3 times for heat"; a report with battery saver on, low RAM and two pauses shows all three, in that order, joined by ", ".
  2. Sort order: with equal speed.tokensPerSecond, rows go by phone name (maker and model) from A to Z; with the same phone and speed, the newer run.date comes first.
  3. Check that each new test can fail: break one expectation on purpose, see it fail, put it back.

Done when

  • The new tests pass, and scripts/devices/table.mjs is unchanged.
  • scripts/devices/fixtures/good-report.json is unchanged: other tests depend on it.

How to check

node --test scripts/devices/table.test.mjs
pnpm test

Keep in mind

  • Tests only. If a test shows a real bug, open a bug report and leave table.mjs alone in this pull request.
  • Made-up phones only, like the Examplecorp EX-1000 in the fixture.
Dominant language
TypeScript
Stars
11
Forks
0
Avg merge
10m
Merged PRs (30d)
6

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 DojoCodingLabs/hermit

All issues in DojoCodingLabs/hermit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.