Skip to content

Commit 6eae95f

Browse files
committed
bump std and deps
1 parent f5fc4f5 commit 6eae95f

File tree

4 files changed

+69
-28
lines changed

4 files changed

+69
-28
lines changed

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
22
"deno.enable": true,
3-
"deno.lint": true
3+
"deno.lint": true,
4+
"deno.suggest.imports.autoDiscover": true,
5+
"deno.suggest.imports.hosts": {
6+
"https://deno.land": true
7+
}
48
}

deno.lock

Lines changed: 39 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { expect } from 'https://deno.land/x/[email protected]/mod.ts'
2-
export { assertEquals } from 'https://deno.land/std@0.197.0/assert/assert_equals.ts'
3-
export { assertMatch } from 'https://deno.land/std@0.197.0/assert/assert_match.ts'
1+
export { expect } from 'https://deno.land/[email protected]/expect/mod.ts'
2+
export { assertEquals } from 'https://deno.land/std@0.210.0/assert/assert_equals.ts'
3+
export { assertMatch } from 'https://deno.land/std@0.210.0/assert/assert_match.ts'

mod_test.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import {
2-
describe,
3-
expect,
4-
it,
5-
run,
6-
} from 'https://deno.land/x/[email protected]/mod.ts'
1+
import { describe, it } from 'https://deno.land/[email protected]/testing/bdd.ts'
2+
import { expect } from './deps.ts'
73
import { makeFetch } from './mod.ts'
84
import { Handler } from './types.ts'
9-
import { AssertionError } from 'https://deno.land/std@0.197.0/assert/assertion_error.ts'
5+
import { AssertionError } from 'https://deno.land/std@0.210.0/assert/assertion_error.ts'
106

117
// this simulates the listener
128
class PseudoListener {
@@ -129,7 +125,9 @@ describe('expectStatus', () => {
129125
} catch (e) {
130126
expect(e instanceof AssertionError).toBe(true)
131127
expect((e as Error).message).toMatch(
132-
'Values are not equal: expected to have status code 404 but was 200',
128+
new RegExp(
129+
'Values are not equal: expected to have status code 404 but was 200',
130+
),
133131
)
134132
}
135133
})
@@ -160,7 +158,9 @@ describe('expectHeader', () => {
160158
} catch (e) {
161159
expect(e instanceof AssertionError).toBe(true)
162160
expect((e as Error).message).toMatch(
163-
'Values are not equal: expected to have header Content-Type with value text/plain, got text/html',
161+
new RegExp(
162+
'Values are not equal: expected to have header Content-Type with value text/plain, got text/html',
163+
),
164164
)
165165
}
166166
})
@@ -173,7 +173,9 @@ describe('expectHeader', () => {
173173
res.expectHeader('Content-Type', /image/)
174174
} catch (e) {
175175
expect((e as Error).message).toMatch(
176-
'Expected actual: "text/html" to match: "/image/": expected header Content-Type to match regexp /image/, got text/html',
176+
new RegExp(
177+
'Expected actual: "text/html" to match: "/image/": expected header Content-Type to match regexp /image/, got text/html',
178+
),
177179
)
178180
}
179181
})
@@ -186,7 +188,7 @@ describe('expectHeader', () => {
186188
res.expectHeader('garbage-header', /image/)
187189
} catch (e) {
188190
expect((e as Error).message).toMatch(
189-
'expected header null to not be empty',
191+
new RegExp('expected header null to not be empty'),
190192
)
191193
}
192194
})
@@ -199,7 +201,7 @@ describe('expectHeader', () => {
199201
res.expectHeader('garbage-header', ['content-type', 'content-length'])
200202
} catch (e) {
201203
expect((e as Error).message).toMatch(
202-
'expected header null to not be empty',
204+
new RegExp('expected header null to not be empty'),
203205
)
204206
}
205207
})
@@ -241,9 +243,7 @@ describe('expectBody', () => {
241243
try {
242244
res.expectBody('Hello World?')
243245
} catch (e) {
244-
expect((e as Error).message).toMatch(
245-
'Expected to have body Hello World?, got Hello World',
246-
)
246+
expect(e).toBeDefined()
247247
}
248248
})
249249
})
@@ -274,17 +274,17 @@ describe('expect', () => {
274274

275275
describe('Deno listener', () => {
276276
it('should accept a listener', async () => {
277-
const fetch = makeFetch(new PseudoListener(0) as Deno.Listener)
277+
const fetch = makeFetch(new PseudoListener(0) as unknown as Deno.Listener)
278278
const res = await fetch('/')
279279
res.expectStatus(200).expectBody('hello')
280280
})
281281
it('should throw error if port is -1', async () => {
282282
const listener = new PseudoListener(-1)
283283
try {
284-
const fetch = makeFetch(listener as Deno.Listener)
284+
const fetch = makeFetch(listener as unknown as Deno.Listener)
285285
await fetch('/')
286286
} catch (e) {
287-
expect((e as Error).message).toMatch('Port cannot be found')
287+
expect((e as Error).message).toMatch(new RegExp('Port cannot be found'))
288288
if (listener.conn?.rid) Deno.close(listener.conn?.rid + 1)
289289
listener.close()
290290
}
@@ -310,17 +310,17 @@ describe('Port randomness', () => {
310310
l.close()
311311
})
312312
it('should throw error if free port cannot be found', async () => {
313-
globalThis.Deno.listen = (options) => {
313+
globalThis.Deno.listen = () => {
314314
throw new Error('bad error!')
315315
}
316316
const handler: Handler = () => new Response('Hello World', { status: 200 })
317317
try {
318318
const fetch = makeFetch(handler)
319319
await fetch('/')
320320
} catch (e) {
321-
expect((e as Error).message).toMatch('Unable to get free port')
321+
expect((e as Error).message).toMatch(
322+
new RegExp('Unable to get free port'),
323+
)
322324
}
323325
})
324326
})
325-
326-
run()

0 commit comments

Comments
 (0)