Web Deployment Checklist: Release and Roll Back a Course App

Practical Web Development — Lesson 10 of 10 · Senior A successful deployment command does not prove a course application works. A release is complete when important user journeys work in the target environment and the team can recognize and recover from a bad change. This lesson turns a small course app into a practical release exercise with explicit acceptance and rollback criteria. Describe the change and its risk Suppose a release adds saved course shortlists. Separate the new browser interface, the server endpoint and any database change. Identify what happens when old browser code talks to the new server, and when the previous server version reads newly written data. Rolling back code is not the same as reversing a data migration. Write a short release record before deploying. Use real commit and build identifiers in your own project; the values below are placeholders for the exercise. Change: Add saved course shortlists Build: <immutable build identifier> Owner: <person ...

Node.js Test Runner: Test Course Filters Without a Framework

Practical Web Development — Lesson 7 of 10 · Intermediate

A small pure function is a useful first testing target: it takes data and returns a result without network or browser dependencies. This lesson separates course filtering from the interface and tests the behaviour using Node's built-in test runner. Use a currently supported Node.js release and save the files with the .mjs extension.

Define the behaviour first

An empty or whitespace-only query returns every course. Matching ignores case. A query that matches nothing returns an empty array. The function should not reorder or change the caller's input array. These rules are a contract a user can observe, rather than a list of implementation details.

Create filter.mjs:

export function filterCourses(courses, query) {
  const term = query.trim().toLowerCase();
  return courses.filter(course => course.title.toLowerCase().includes(term));
}

Create filter.test.mjs in the same folder:

import test from 'node:test';
import assert from 'node:assert/strict';
import { filterCourses } from './filter.mjs';
const courses = [
  { id: 'html', title: 'HTML fundamentals' },
  { id: 'css', title: 'CSS layout' }
];
test('matches without case sensitivity and trims the query', () => {
  assert.deepEqual(filterCourses(courses, '  cSs ').map(x => x.id), ['css']);
});
test('blank query includes all courses', () => {
  assert.deepEqual(filterCourses(courses, '   '), courses);
});
test('unknown term returns no matches', () => {
  assert.deepEqual(filterCourses(courses, 'database'), []);
});
test('does not mutate the input', () => {
  const snapshot = structuredClone(courses);
  filterCourses(courses, 'html');
  assert.deepEqual(courses, snapshot);
});

Run node --test filter.test.mjs from that folder. All four tests should pass. Change includes to startsWith and add a test searching for “layout”; that new test should expose the changed behaviour.

Use failures as useful feedback

A failing assertion should tell you which promise the function broke. Prefer names that describe outcomes. Avoid checking which array method was used: an equally correct implementation should pass. When a real bug appears, add the smallest test that reproduces its user-visible effect before fixing it.

Keep the boundary explicit

This function assumes an array of objects with string titles and a string query. Validate API data before calling it, as in the earlier TypeScript boundary lesson. Testing this pure function does not prove that the browser reads the input field correctly, renders an empty state or handles a failed request. Those need integration or browser tests.

Practice

Add an optional level filter and write cases for all levels, one known level and an unknown level. Decide whether an unknown level returns no courses or falls back to all before you write the implementation. That design decision matters more than the number of assertions.

Continue learning

Review our semantic HTML project, JavaScript course filter and course platform architecture.

Reference: Technical documentation for this lesson. Examples are learning exercises; test them in your environment.

Comments

Popular posts from this blog

What Is Multimedia? Examples and a Beginner Course Guide

VR vs AR: Differences, Uses and Multimedia Design

Internet vs World Wide Web: HTML and Multimedia Explained