Skip to content

Commit 0cd3a80

Browse files
committed
Clarify what changes are done in the code example
1 parent ceed603 commit 0cd3a80

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

src/content/4/en/part4b.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ test('the first note is about HTTP methods', async () => {
227227
const response = await api.get('/api/notes')
228228

229229
const contents = response.body.map(e => e.content)
230-
// is the argument truthy
231230
assert(contents.includes('HTML is easy'))
232231
})
233232
```
@@ -312,21 +311,19 @@ beforeEach(async () => {
312311

313312
The database is cleared out at the beginning, and after that, we save the two notes stored in the _initialNotes_ array to the database. By doing this, we ensure that the database is in the same state before every test is run.
314313

315-
Let's also make the following changes to the last two tests:
314+
Let's modify the test that checks the number of notes as follows:
316315

317316
```js
317+
// ...
318+
318319
test('there are two notes', async () => {
319320
const response = await api.get('/api/notes')
320321

321-
assert.strictEqual(response.body.length, initialNotes.length)
322+
assert.strictEqual(response.body.length, initialNotes.length) // highlight-line
322323
})
323324

324-
test('the first note is about HTTP methods', async () => {
325-
const response = await api.get('/api/notes')
325+
// ...
326326

327-
const contents = response.body.map(e => e.content)
328-
assert(contents.includes('HTML is easy'))
329-
})
330327
```
331328

332329
### Running tests one by one

src/content/4/fi/osa4b.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ test('the first note is about HTTP methods', async () => {
224224
const response = await api.get('/api/notes')
225225

226226
const contents = response.body.map(e => e.content)
227-
// is the parameter truthy
228227
assert(contents.includes('HTML is easy'))
229228
})
230229
```
@@ -310,21 +309,18 @@ beforeEach(async () => {
310309

311310
Tietokanta siis tyhjennetään aluksi, ja sen jälkeen kantaan lisätään kaksi taulukkoon _initialNotes_ talletettua muistiinpanoa. Näin testien suoritus aloitetaan aina hallitusti samasta tilasta.
312311

313-
Muutetaan kahta jälkimmäistä testiä vielä seuraavasti:
312+
Muutetaan muistiinpanojen lukumäärää testaavaa testiä vielä seuraavasti:
314313

315314
```js
315+
// ...
316+
316317
test('there are two notes', async () => {
317318
const response = await api.get('/api/notes')
318319

319-
assert.strictEqual(response.body.length, initialNotes.length)
320+
assert.strictEqual(response.body.length, initialNotes.length) // highlight-line
320321
})
321322

322-
test('the first note is about HTTP methods', async () => {
323-
const response = await api.get('/api/notes')
324-
325-
const contents = response.body.map(e => e.content)
326-
assert(contents.includes('HTML is easy'))
327-
})
323+
// ...
328324

329325
```
330326

0 commit comments

Comments
 (0)