LEARN. PRACTICE. EXPLAIN.
Learning paths & interview practiceP
← Build a contract & boundary test harness
BUILD → VERIFY → EXPLAIN · STEP 3 OF 6

Validate API contracts and block PII leakage

Assert explicit field shapes while ensuring sensitive attributes never leak.

UNDERSTAND

Bring these concepts with you

BUILD

Your implementation

  1. Implement assertOrderContract(response) validating id, status enum, non-negative integer totalCents, and 3-letter currency.
  2. Throw a clear error if sensitive keys like cardNumber, cvv, password, or token appear anywhere on the response.
export function assertOrderContract(response) {
  // Validate required order schema and reject sensitive fields.
}
Need a hint?
  • Normalize key names to lowercase when checking forbidden attributes.
  • Validate types strictly so numeric strings or negative totals fail loudly.

Saved on this device · 0 / 6000 · Do not include passwords or private data.

VERIFY

Acceptance checks

From the folder containing your downloaded files, run:

node checks.mjs ./starter.mjs 3

This runs checks up to this step. Earlier steps must work first. Mark each result only after checking your implementation; the website does not run or grade it.

Record your attempt to enable the checklist and reference comparison.

Compare with the reference

Attempt the step first, then compare decisions and behavior. There can be more than one correct implementation.

EXPLAIN

Your interviewer asks

Why can a 200 OK UI check miss a serious API authorization or PII leak?

Say your answer aloud, then record the trade-offs and evidence in your notes above.

LOCAL VOICE REHEARSAL

Rehearse your step walkthrough aloud

Target pacing: 02:00 · Stays in this browser only; never uploaded.

00:00/ 02:00
AlifBay Prep