{"schemaVersion":1,"contentVersion":"3.4.0","id":"foundation.12","languages":{"javascript":{"id":"foundation.12","title":"Checkpoint: search and edit in real files","moduleName":"Search and apply","tips":"","concept":"<p class=\"lead\">Make three or four changes in each of three real files. Most of them are a search away.</p><p><strong>Before this lesson:</strong> Editing foundations, the word and quotation lessons, and the search lessons.</p><p>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.</p><p>Compare your whole result with the target before you finish.</p>","teaches":["char-delete","door-A","search:/"],"introduces":["textobject"],"constraints":[],"drills":[{"task":"Shipping 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 <code>costs nothing above the threshold</code>. You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"jsx","start":"import { describe, expect, it } from \"vitest\";\nimport { shippingCost } from \"./shipping.js\";\n\ndescribe(\"shippingCost\", () => {\n  it(\"is still free over 5000 in the Netherlands\", () => {\n    expect(shippingCost({ country: \"NL\", total: 6000 })).toBe(0);\n  });\n  it(\"charges 495 in the Netherlands\", () => {\n    expect(shippingCost({ country: \"NL\", total: 1400 })).toBe(495);\n  });\n  it(\"charges 995 to the rest of the EU\", () => {\n    expect(shippingCost({ country: \"DE\", total: 2000 })).toBe(995);\n  });\n  it(\"charges more to the United Kingdom\", () => {\n    expect(shippingCost({ country: \"GB\", total: 2000 })).toBe(1495);\n    // 1495 includes the customs fee, which the courier collects.\n  });\n});","startCursor":{"line":1,"ch":0},"paths":[{"keys":["3","j","c","i","\"","costs nothing above the threshold","<Esc>","/","149","<CR>","c","w","1750","<Esc>","n","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","search:n","textobject:i\""],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"import { describe, expect, it } from \"vitest\";\nimport { shippingCost } from \"./shipping.js\";\n\ndescribe(\"shippingCost\", () => {\n  it(\"costs nothing above the threshold\", () => {\n    expect(shippingCost({ country: \"NL\", total: 6000 })).toBe(0);\n  });\n  it(\"charges 495 in the Netherlands\", () => {\n    expect(shippingCost({ country: \"NL\", total: 1400 })).toBe(495);\n  });\n  it(\"charges 995 to the rest of the EU\", () => {\n    expect(shippingCost({ country: \"DE\", total: 2000 })).toBe(995);\n  });\n  it(\"charges more to the United Kingdom\", () => {\n    expect(shippingCost({ country: \"GB\", total: 2000 })).toBe(1750);\n  });\n});","language":"javascript","evidence":"checkpoint","canonicalKey":"foundation.12#0","canonicalFingerprint":"qoe5hz"},{"task":"We're moving to <code>northwind.com</code>, and images come from the CDN's default address now. Make the help address <code>help@northwind.com</code>, delete the image host, and fix the typo in the currency. You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"jsx","start":"// Settings the storefront reads at startup. Prices are in cents.\nexport const config = {\n  features: { wishlist: true, giftWrap: false, reviews: true },\n  currency: \"EUUR\",\n  locale: \"nl-NL\",\n  freeShippingOver: 5000,\n  productsPerPage: 24,\n  analytics: { enabled: true, sampleRate: 0.25 },\n  pickup: {\n    address: \"Keizersgracht 12, Amsterdam\",\n    opensAt: \"09:00\",\n    closesAt: \"18:00\",\n  },\n  helpEmail: \"help@northwind.shop\",\n  imageHost: \"https://images.northwind.shop/v2\",\n  supportPhone: \"+31 20 555 0134\",\n  orderEmailsFrom: \"Northwind <orders@northwind.com>\",\n  maintenance: false,\n};","startCursor":{"line":1,"ch":0},"paths":[{"keys":["2","j","f","U","x","/","sho","<CR>","c","w","com","<Esc>","n","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","search:n","char-search","char-delete"],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"// Settings the storefront reads at startup. Prices are in cents.\nexport const config = {\n  features: { wishlist: true, giftWrap: false, reviews: true },\n  currency: \"EUR\",\n  locale: \"nl-NL\",\n  freeShippingOver: 5000,\n  productsPerPage: 24,\n  analytics: { enabled: true, sampleRate: 0.25 },\n  pickup: {\n    address: \"Keizersgracht 12, Amsterdam\",\n    opensAt: \"09:00\",\n    closesAt: \"18:00\",\n  },\n  helpEmail: \"help@northwind.com\",\n  supportPhone: \"+31 20 555 0134\",\n  orderEmailsFrom: \"Northwind <orders@northwind.com>\",\n  maintenance: false,\n};","language":"javascript","evidence":"checkpoint","canonicalKey":"foundation.12#1","canonicalFingerprint":"jxaiov"},{"task":"We call it a cart now, and we don't show a message when something is removed. Change <code>basket</code> to <code>cart</code> in the added message, delete the removed message, fix the typo in <code>Continnue</code>, and make the empty message <code>Nothing here yet</code>. You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"jsx","start":"// English text for the checkout pages.\nexport const en = {\n  empty: \"Your cart is empty\",\n  continue: \"Continnue shopping\",\n  title: \"Checkout\",\n  remove: \"Remove\",\n  quantity: \"Quantity\",\n  subtotal: \"Subtotal\",\n  shipping: \"Shipping\",\n  vat: \"VAT\",\n  total: \"Total, VAT included\",\n  pay: \"Go to payment\",\n  back: \"Back to the shop\",\n  added: (name) => `${name} is in your basket`,\n  removed: (name) => `${name} was removed from your basket`,\n};","startCursor":{"line":0,"ch":0},"paths":[{"keys":["2","j","c","i","\"","Nothing here yet","<Esc>","j","F","n","x","/","bas","<CR>","c","w","cart","<Esc>","n","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","search:n","textobject:i\"","char-delete"],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"// English text for the checkout pages.\nexport const en = {\n  empty: \"Nothing here yet\",\n  continue: \"Continue shopping\",\n  title: \"Checkout\",\n  remove: \"Remove\",\n  quantity: \"Quantity\",\n  subtotal: \"Subtotal\",\n  shipping: \"Shipping\",\n  vat: \"VAT\",\n  total: \"Total, VAT included\",\n  pay: \"Go to payment\",\n  back: \"Back to the shop\",\n  added: (name) => `${name} is in your cart`,\n};","language":"javascript","evidence":"checkpoint","canonicalKey":"foundation.12#2","canonicalFingerprint":"97mrl0"}]},"python":{"id":"foundation.12","title":"Checkpoint: search and edit in real files","moduleName":"Search and apply","tips":"","concept":"<p class=\"lead\">Make three or four changes in each of three real files. Most of them are a search away.</p><p><strong>Before this lesson:</strong> Editing foundations, the word and quotation lessons, and the search lessons.</p><p>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.</p><p>Compare your whole result with the target before you finish.</p>","teaches":["char-delete","door-A","search:/"],"introduces":["textobject"],"constraints":[],"drills":[{"task":"Shipping to the UK costs 1750 now, and customs are charged separately. Update what the UK test expects, delete the comment about customs, and fix the typo in <code>threshhold</code>. You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"python","start":"from shop.shipping import shipping_cost\n\n\ndef test_free_over_the_threshhold():\n    assert shipping_cost(country=\"NL\", total=6000) == 0\n\n\ndef test_netherlands():\n    assert shipping_cost(country=\"NL\", total=1400) == 495  # pays for shipping\n\n\ndef test_rest_of_the_eu():\n    assert shipping_cost(country=\"DE\", total=2000) == 995\n\n\ndef test_united_kingdom():\n    assert shipping_cost(country=\"GB\", total=2000) == 1495\n    # The price includes the customs fee, which the courier collects.\n    assert shipping_cost(country=\"GB\", total=90000) > 0\n    assert shipping_cost(country=\"GB\", total=1400) > 0  # never free","startCursor":{"line":0,"ch":0},"paths":[{"keys":["/","hol","<CR>","x","/","149","<CR>","c","w","1750","<Esc>","j","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","char-delete"],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"from shop.shipping import shipping_cost\n\n\ndef test_free_over_the_threshold():\n    assert shipping_cost(country=\"NL\", total=6000) == 0\n\n\ndef test_netherlands():\n    assert shipping_cost(country=\"NL\", total=1400) == 495  # pays for shipping\n\n\ndef test_rest_of_the_eu():\n    assert shipping_cost(country=\"DE\", total=2000) == 995\n\n\ndef test_united_kingdom():\n    assert shipping_cost(country=\"GB\", total=2000) == 1750\n    assert shipping_cost(country=\"GB\", total=90000) > 0\n    assert shipping_cost(country=\"GB\", total=1400) > 0  # never free","language":"python","evidence":"checkpoint","canonicalKey":"foundation.12#0","canonicalFingerprint":"qoe5hz"},{"task":"We're moving to <code>northwind.com</code>, and media come from the CDN's default address now. Send email from <code>help@northwind.com</code>, delete the media address, and set the time zone to <code>Europe/Amsterdam</code>. You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"python","start":"\"\"\"Settings for the live site. Secrets come from the environment.\"\"\"\nimport os\n\nfrom .base import *  # noqa: F403\n\nTIME_ZONE = \"UTC\"\nUSE_TZ = True\nFEATURES = {\"wishlist\": True, \"gift_wrap\": False, \"reviews\": True}\nDEBUG = False\nALLOWED_HOSTS = [os.environ[\"PUBLIC_HOST\"]]\nSECRET_KEY = os.environ[\"SECRET_KEY\"]\nFREE_SHIPPING_OVER = 5000\nSESSION_COOKIE_SECURE = True\nCSRF_COOKIE_SECURE = True\nSECURE_HSTS_SECONDS = 60 * 60 * 24 * 365\nDEFAULT_FROM_EMAIL = \"help@northwind.shop\"\nSERVER_EMAIL = \"errors@northwind.com\"\nMEDIA_URL = \"https://images.northwind.shop/media/\"\nADMINS = [(\"Ops\", \"ops@northwind.com\")]\nSTATUS_PAGE_URL = \"https://status.northwind.com\"","startCursor":{"line":0,"ch":0},"paths":[{"keys":["5","j","c","i","\"","Europe/Amsterdam","<Esc>","/","sho","<CR>","c","w","com","<Esc>","n","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","search:n","textobject:i\""],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"\"\"\"Settings for the live site. Secrets come from the environment.\"\"\"\nimport os\n\nfrom .base import *  # noqa: F403\n\nTIME_ZONE = \"Europe/Amsterdam\"\nUSE_TZ = True\nFEATURES = {\"wishlist\": True, \"gift_wrap\": False, \"reviews\": True}\nDEBUG = False\nALLOWED_HOSTS = [os.environ[\"PUBLIC_HOST\"]]\nSECRET_KEY = os.environ[\"SECRET_KEY\"]\nFREE_SHIPPING_OVER = 5000\nSESSION_COOKIE_SECURE = True\nCSRF_COOKIE_SECURE = True\nSECURE_HSTS_SECONDS = 60 * 60 * 24 * 365\nDEFAULT_FROM_EMAIL = \"help@northwind.com\"\nSERVER_EMAIL = \"errors@northwind.com\"\nADMINS = [(\"Ops\", \"ops@northwind.com\")]\nSTATUS_PAGE_URL = \"https://status.northwind.com\"","language":"python","evidence":"checkpoint","canonicalKey":"foundation.12#1","canonicalFingerprint":"jxaiov"},{"task":"We call it a cart now, and we don't show a message when something is removed. Change <code>basket</code> to <code>cart</code> in the added message, delete the removed message, fix the typo in <code>Continnue</code>, and make the empty message <code>Nothing here yet</code>. You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"python","start":"\"\"\"Text for the checkout pages, in English.\"\"\"\nEMPTY = \"Your cart is empty\"\nCONTINUE = \"Continnue shopping\"\nTITLE = \"Checkout\"\nREMOVE = \"Remove\"\nQUANTITY = \"Quantity\"\nSUBTOTAL = \"Subtotal\"\nSHIPPING = \"Shipping\"\nVAT = \"VAT\"\nTOTAL = \"Total, VAT included\"\nPAY = \"Go to payment\"\nBACK = \"Back to the shop\"\nADDED = \"{name} is in your basket\"\nREMOVED = \"{name} was removed from your basket\"","startCursor":{"line":0,"ch":0},"paths":[{"keys":["j","c","i","\"","Nothing here yet","<Esc>","j","F","n","x","/","bas","<CR>","c","w","cart","<Esc>","n","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","search:n","textobject:i\"","char-delete"],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"\"\"\"Text for the checkout pages, in English.\"\"\"\nEMPTY = \"Nothing here yet\"\nCONTINUE = \"Continue shopping\"\nTITLE = \"Checkout\"\nREMOVE = \"Remove\"\nQUANTITY = \"Quantity\"\nSUBTOTAL = \"Subtotal\"\nSHIPPING = \"Shipping\"\nVAT = \"VAT\"\nTOTAL = \"Total, VAT included\"\nPAY = \"Go to payment\"\nBACK = \"Back to the shop\"\nADDED = \"{name} is in your cart\"","language":"python","evidence":"checkpoint","canonicalKey":"foundation.12#2","canonicalFingerprint":"97mrl0"}]},"text":{"id":"foundation.12","title":"Checkpoint: search and edit in real files","moduleName":"Search and apply","tips":"","concept":"<p class=\"lead\">Make three or four changes in each of three real files. Most of them are a search away.</p><p><strong>Before this lesson:</strong> Editing foundations, the word and quotation lessons, and the search lessons.</p><p>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.</p><p>Compare your whole result with the target before you finish.</p>","teaches":["char-delete","door-A","search:/"],"introduces":["textobject"],"constraints":[],"drills":[{"task":"The team channel is <code>#shop</code> now, and releases aren't announced any more. Change <code>#web</code> to <code>#shop</code> in the line about questions, delete the line about releases, and end step 1 with <code> Use the version in .nvmrc.</code> You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"text/plain","start":"# Northwind shop\n\nThe storefront, the admin and the API, in one repo. Ask Dana for access.\n\n## Getting started\n\n1. Install Node 24 and pnpm.\n2. Copy .env.example to .env and fill in the keys from the vault.\n3. Run \"pnpm dev\" and open localhost:3000.\n4. Sign in with the demo account from the wiki.\n\n## Working here\n\nOpen a pull request for every change, however small, and ask for one review.\nTests run on every push. Keep them green, and fix a red build before anything else.\nMerging to main deploys the shop within about ten minutes.\nAsk questions about the code in #web so the whole team sees them.\nReleases are announced in #web on Fridays, with a list of what changed.\nIf a deploy fails, roll back first and look at the logs after.\nThe on-call person decides whether a fix can wait until Monday.","startCursor":{"line":0,"ch":2},"paths":[{"keys":["7","G","A"," Use the version in .nvmrc.","<Esc>","/","web","<CR>","c","w","shop","<Esc>","n","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","search:n","door-A"],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"# Northwind shop\n\nThe storefront, the admin and the API, in one repo. Ask Dana for access.\n\n## Getting started\n\n1. Install Node 24 and pnpm. Use the version in .nvmrc.\n2. Copy .env.example to .env and fill in the keys from the vault.\n3. Run \"pnpm dev\" and open localhost:3000.\n4. Sign in with the demo account from the wiki.\n\n## Working here\n\nOpen a pull request for every change, however small, and ask for one review.\nTests run on every push. Keep them green, and fix a red build before anything else.\nMerging to main deploys the shop within about ten minutes.\nAsk questions about the code in #shop so the whole team sees them.\nIf a deploy fails, roll back first and look at the logs after.\nThe on-call person decides whether a fix can wait until Monday.","language":"text","evidence":"checkpoint","canonicalKey":"foundation.12#0","canonicalFingerprint":"qoe5hz"},{"task":"We test on Node 22 now. Use <code>22</code> in the test job, delete the comment about Node 18, and name the workflow <code>Test and build</code>. You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"text/plain","start":"name: \"Checks\"\non: [push, pull_request]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with: { cache: npm, node-version: 18 }\n      # 18 is the oldest Node we support, so we test on it.\n      - run: npm ci && npm test\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with: { cache: npm, node-version: 24 }\n      - run: npm ci && npm run build","startCursor":{"line":1,"ch":0},"paths":[{"keys":["k","c","i","\"","Test and build","<Esc>","/","18","<CR>","c","w","22","<Esc>","n","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","search:n","textobject:i\""],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"name: \"Test and build\"\non: [push, pull_request]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with: { cache: npm, node-version: 22 }\n      - run: npm ci && npm test\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with: { cache: npm, node-version: 24 }\n      - run: npm ci && npm run build","language":"text","evidence":"checkpoint","canonicalKey":"foundation.12#1","canonicalFingerprint":"jxaiov"},{"task":"The van comes on Tuesday now, and it only tries once. Change <code>Thursday</code> to <code>Tuesday</code> in the delivery time, delete the line about trying again, and remove <code>now</code> from the subject. You can use any commands.","hint":"Search for what changes. When the same word changes twice, n takes you to the next one.","mode":"text/plain","start":"Subject: Your delivery is now booked\n\nHi Dana, your order 1042 is packed and ready to go.\nWe'll text you an hour before the van arrives, so keep your phone close.\nThe driver can't leave it outside, so someone needs to be at home.\nIf that's a problem, reply to this email and we'll arrange a pickup point.\n\nBring your order number if you collect it: it's at the top of this email.\nWe'll keep the parcel for a week. After that, it goes back to the warehouse.\n\nDelivery time: Thursday, between 8:00 and 12:00, at the address on your order\nIf we miss you on Thursday, the driver tries again the next morning.\nPlease check that the address is right, and reply if anything needs to change.\n\nThanks for shopping with us, and let us know if anything is wrong.\nNorthwind, deliveries team","startCursor":{"line":0,"ch":0},"paths":[{"keys":["f","n","d","w","/","Thu","<CR>","c","w","Tuesday","<Esc>","n","d","d"],"tier":"idiomatic","technique":"search:/","core":["search:/","search:n"],"note":"This is a clean route with what you've learned so far. Any other way that gets the same result is fine too."}],"target":"Subject: Your delivery is booked\n\nHi Dana, your order 1042 is packed and ready to go.\nWe'll text you an hour before the van arrives, so keep your phone close.\nThe driver can't leave it outside, so someone needs to be at home.\nIf that's a problem, reply to this email and we'll arrange a pickup point.\n\nBring your order number if you collect it: it's at the top of this email.\nWe'll keep the parcel for a week. After that, it goes back to the warehouse.\n\nDelivery time: Tuesday, between 8:00 and 12:00, at the address on your order\nPlease check that the address is right, and reply if anything needs to change.\n\nThanks for shopping with us, and let us know if anything is wrong.\nNorthwind, deliveries team","language":"text","evidence":"checkpoint","canonicalKey":"foundation.12#2","canonicalFingerprint":"97mrl0"}]}},"concepts":{"javascript":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Editing foundations, the word and quotation lessons, and the search lessons.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Make three or four changes in each of three real files. Most of them are a search away.</p><p>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.</p><p>Compare your whole result with the target before you finish.</p></div></details>"},"python":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Editing foundations, the word and quotation lessons, and the search lessons.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Make three or four changes in each of three real files. Most of them are a search away.</p><p>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.</p><p>Compare your whole result with the target before you finish.</p></div></details>"},"text":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Editing foundations, the word and quotation lessons, and the search lessons.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Make three or four changes in each of three real files. Most of them are a search away.</p><p>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.</p><p>Compare your whole result with the target before you finish.</p></div></details>"}}}