Skip to content

Commit 205ccc5

Browse files
committed
Fix failing bookstore demo tests
1 parent 6b101df commit 205ccc5

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

demos/bookstore/app/books.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ describe('books handlers', () => {
1111
assert.equal(response.status, 200)
1212
let html = await response.text()
1313
assertContains(html, 'Browse Books')
14-
assertContains(html, 'The Midnight Library')
15-
assertContains(html, 'Atomic Habits')
16-
assertContains(html, 'Dune')
14+
assertContains(html, 'Ash & Smoke')
15+
assertContains(html, 'Heavy Metal Guitar Riffs')
16+
assertContains(html, 'Three Ways to Change Your Life')
1717
})
1818

1919
it('GET /books/:slug returns book details', async () => {
20-
let response = await router.fetch('http://localhost:3000/books/dune')
20+
let response = await router.fetch('http://localhost:3000/books/bbq')
2121

2222
assert.equal(response.status, 200)
2323
let html = await response.text()
24-
assertContains(html, 'Dune')
25-
assertContains(html, 'Frank Herbert')
24+
assertContains(html, 'Ash & Smoke')
25+
assertContains(html, 'Rusty Char-Broil')
2626
assertContains(html, 'Add to Cart')
2727
})
2828

demos/bookstore/app/cart.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ describe('cart handlers', () => {
99
let response = await router.fetch('http://localhost:3000/cart/api/add', {
1010
method: 'POST',
1111
body: new URLSearchParams({
12-
bookId: '1',
13-
slug: 'the-midnight-library',
12+
bookId: '001',
13+
slug: 'bbq',
1414
}),
1515
redirect: 'manual',
1616
})
@@ -24,8 +24,8 @@ describe('cart handlers', () => {
2424
let addResponse = await router.fetch('http://localhost:3000/cart/api/add', {
2525
method: 'POST',
2626
body: new URLSearchParams({
27-
bookId: '2',
28-
slug: 'atomic-habits',
27+
bookId: '002',
28+
slug: 'heavy-metal',
2929
}),
3030
redirect: 'manual',
3131
})
@@ -40,16 +40,16 @@ describe('cart handlers', () => {
4040
assert.equal(response.status, 200)
4141
let html = await response.text()
4242
assertContains(html, 'Shopping Cart')
43-
assertContains(html, 'Atomic Habits')
43+
assertContains(html, 'Heavy Metal Guitar Riffs')
4444
})
4545

4646
it('cart persists state across requests with same session', async () => {
4747
// Add first item
4848
let addResponse1 = await router.fetch('http://localhost:3000/cart/api/add', {
4949
method: 'POST',
5050
body: new URLSearchParams({
51-
bookId: '1',
52-
slug: 'the-midnight-library',
51+
bookId: '001',
52+
slug: 'bbq',
5353
}),
5454
redirect: 'manual',
5555
})
@@ -61,8 +61,8 @@ describe('cart handlers', () => {
6161
let addRequest2 = requestWithSession('http://localhost:3000/cart/api/add', sessionId, {
6262
method: 'POST',
6363
body: new URLSearchParams({
64-
bookId: '3',
65-
slug: 'project-hail-mary',
64+
bookId: '003',
65+
slug: 'three-ways',
6666
}),
6767
})
6868
await router.fetch(addRequest2)
@@ -72,7 +72,7 @@ describe('cart handlers', () => {
7272
let cartResponse = await router.fetch(cartRequest)
7373

7474
let html = await cartResponse.text()
75-
assertContains(html, 'The Midnight Library')
76-
assertContains(html, 'Project Hail Mary')
75+
assertContains(html, 'Ash & Smoke')
76+
assertContains(html, 'Three Ways to Change Your Life')
7777
})
7878
})

demos/bookstore/app/checkout.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ describe('checkout handlers', () => {
1919
let addRequest = requestWithSession('http://localhost:3000/cart/api/add', sessionId, {
2020
method: 'POST',
2121
body: new URLSearchParams({
22-
bookId: '5',
23-
slug: 'dune',
22+
bookId: '001',
23+
slug: 'bbq',
2424
}),
2525
})
2626
await router.fetch(addRequest)

0 commit comments

Comments
 (0)