Skip to content

C2 Small repository investigation

10 minSuggested first: L12 Interfaces and dispatch

Outcome

Resolve a re-export, read what a test covers, and trace the branch one input takes.

The case

Three files, three items. Each item has one accepted answer and can be retried; after a miss, the review link names the lesson to revisit. Nothing is locked by your score.

index.tsTypeScript
export { charge as quote } from "./pricing";
pricing.tsTypeScript
export function charge(n: number, fee = 2) {
  return n > 0 ? add(n, fee) : 0;
}
function add(n: number, fee: number) { return n + fee; }
pricing.test.tsTypeScript
import { quote } from "./index";
assertEqual(quote(3), 5);

Checkpoint items

1. Find

Counts toward completion

Where is the body behind quote?

Choose one answer

2. Evidence

Counts toward completion

Which fee case does the assertion in pricing.test.ts cover?

Choose one answer

3. Trace

Counts toward completion

For quote(0), start at the original definition and list the functions entered through the return, leaving out built-ins.

Choose one answer

Review

Revisit any missed item the next day, then try a Trace puzzle in a repository you haven't read yet.