Skip to content

Commit

Permalink
fixing tests with the dynamic secret
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-flinn committed Sep 21, 2023
1 parent 09619a5 commit 477e733
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ app.delete('/drip/*', async(c, next) => {

app.delete(
'/drip/:id',
async (c, next) => {
async c => {
const { id } = c.req.param()
const { success } = await c.env.DB_DRIP.prepare(`
delete from drip where id=?
Expand Down
9 changes: 4 additions & 5 deletions backend/test/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ export default function () {
group('drip', function () {
const res = http.get(`${BASE_URL}/drip`)

const json = res.json()
check(res, {
'GET: status is 200': (r) => r.status === 200,
'GET: verify body': (r) => r.body.includes('GET called on /drip')
'GET: verify body': (r) => "data" in json
})

sleep(SLEEP_TIME) // second
})

// GROUP: drip
group('drip', function () {
const res = http.post(`${BASE_URL}/drip`)

Expand All @@ -90,7 +90,6 @@ export default function () {
sleep(SLEEP_TIME) // second
})

// GROUP: drip
group('drip', function () {
const payload = JSON.stringify({
message: 'hello',
Expand All @@ -105,7 +104,7 @@ export default function () {

const res = http.post(`${BASE_URL}/drip`, payload, params)
check(res, {
'POST - create: status is 200': (r) => r.status === 200,
'POST - create: status is 201': (r) => r.status === 201,
'POST - create: verify body': (r) => r.body.includes('create')
})

Expand All @@ -127,7 +126,7 @@ export default function () {

const res = http.post(`${BASE_URL}/drip`, payload, params)
check(res, {
'POST - update: status is 200': (r) => r.status === 200,
'POST - update: status is 201': (r) => r.status === 201,
'POST - update: verify body': (r) => r.body.includes('update')
})

Expand Down

0 comments on commit 477e733

Please sign in to comment.