Checkpoint: search and edit in real files
The technique
The search takes you to the first one without counting lines, and n finds the next. cw changes the word from its start.
Keys in this lesson
- /text
- Search forward. Press Enter to go.
- n
- Next match.
- cw
- Change to the end of the word.
- ci"
- Change the text inside double quotes.
- x
- Delete one character.
- A
- Insert at the end of the line.
Before this lesson: Editing foundations, the word and quotation lessons, and the search lessons.
More about this lesson
Make three or four changes in each of three real files. Most of them are a search away.
You choose the commands. Search for what changes, and when the same word changes twice, n takes you to the next one. Try without hints first, and open help if you need it.
Compare your whole result with the target before you finish.
Guides on this topic
Exercise 1 of 3
0keys
par 54Shipping to the UK costs 1750 now, and customs are charged separately. Update what the UK test expects, delete the comment about customs, and rename the first test to costs nothing above the threshold. You can use any commands.
Make it look like this
import { describe, expect, it } from "vitest"; import { shippingCost } from "./shipping.js"; describe("shippingCost", () => { it("costs nothing above the threshold", () => { expect(shippingCost({ country: "NL", total: 6000 })).toBe(0); }); it("charges 495 in the Netherlands", () => { expect(shippingCost({ country: "NL", total: 1400 })).toBe(495); }); it("charges 995 to the rest of the EU", () => { expect(shippingCost({ country: "DE", total: 2000 })).toBe(995); }); it("charges more to the United Kingdom", () => { expect(shippingCost({ country: "GB", total: 2000 })).toBe(1750); }); });