Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit cf4625b

Browse files
committed
chore: update testings
1 parent cbe2325 commit cf4625b

File tree

4 files changed

+78
-77
lines changed

4 files changed

+78
-77
lines changed

framework/core/routing_test.ts

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { assertEquals } from 'https://deno.land/[email protected]/testing/asserts.ts'
2+
import { Routing } from './routing.ts'
23

3-
const routing = new Routing([], '/', 'en', ['en', 'zh-CN'])
4-
5-
Deno.test(`routing #01`, () => {
4+
Deno.test(`routing`, () => {
5+
const routing = new Routing([], '/', 'en', ['en', 'zh-CN'])
66
routing.update({ url: '/pages/index.tsx', hash: '' })
77
routing.update({ url: '/pages/blog/index.tsx', hash: '' })
88
routing.update({ url: '/pages/blog/[slug].tsx', hash: '' })
@@ -15,6 +15,7 @@ Deno.test(`routing #01`, () => {
1515
routing.update({ url: '/pages/docs/get-started.tsx', hash: '' })
1616
routing.update({ url: '/pages/docs/installation.tsx', hash: '' })
1717
routing.update({ url: '/pages/index.tsx', hash: 'hsidfshy3yhfya49848' })
18+
1819
assertEquals(routing.paths, [
1920
'/',
2021
'/blog',
@@ -26,84 +27,84 @@ Deno.test(`routing #01`, () => {
2627
'/docs/get-started',
2728
'/docs/installation',
2829
])
29-
})
3030

31-
Deno.test(`routing #02`, () => {
32-
const [router, tree] = routing.createRouter({ pathname: '/' })
33-
assertEquals(router.locale, 'en')
34-
assertEquals(router.pathname, '/')
35-
assertEquals(router.pagePath, '/')
36-
assertEquals(tree, [{ url: '/pages/index.tsx', hash: 'hsidfshy3yhfya49848' }])
37-
})
31+
{
32+
const [router, chain] = routing.createRouter({ pathname: '/' })
33+
assertEquals(router.locale, 'en')
34+
assertEquals(router.pathname, '/')
35+
assertEquals(router.pagePath, '/')
36+
assertEquals(chain, [{ url: '/pages/index.tsx', hash: 'hsidfshy3yhfya49848' }])
37+
}
3838

39-
Deno.test(`routing #03`, () => {
40-
const [router, tree] = routing.createRouter({ pathname: '/zh-CN' })
41-
assertEquals(router.locale, 'zh-CN')
42-
assertEquals(router.pathname, '/')
43-
assertEquals(router.pagePath, '/')
44-
assertEquals(tree, [{ url: '/pages/index.tsx', hash: 'hsidfshy3yhfya49848' }])
45-
})
39+
{
40+
const [router, chain] = routing.createRouter({ pathname: '/zh-CN' })
41+
assertEquals(router.locale, 'zh-CN')
42+
assertEquals(router.pathname, '/')
43+
assertEquals(router.pagePath, '/')
44+
assertEquals(chain, [{ url: '/pages/index.tsx', hash: 'hsidfshy3yhfya49848' }])
45+
}
4646

47-
Deno.test(`routing #04`, () => {
48-
const [router, tree] = routing.createRouter({ pathname: '/blog' })
49-
assertEquals(router.locale, 'en')
50-
assertEquals(router.pathname, '/blog')
51-
assertEquals(router.pagePath, '/blog')
52-
assertEquals(tree.map(({ url }) => url), ['/pages/blog.tsx', '/pages/blog/index.tsx'])
53-
})
47+
{
48+
const [router, chain] = routing.createRouter({ pathname: '/blog' })
49+
assertEquals(router.locale, 'en')
50+
assertEquals(router.pathname, '/blog')
51+
assertEquals(router.pagePath, '/blog')
52+
assertEquals(chain.map(({ url }) => url), ['/pages/blog.tsx', '/pages/blog/index.tsx'])
53+
}
5454

55-
Deno.test(`routing #05`, () => {
56-
const [router, tree] = routing.createRouter({ pathname: '/zh-CN/blog' })
57-
assertEquals(router.locale, 'zh-CN')
58-
assertEquals(router.pathname, '/blog')
59-
assertEquals(router.pagePath, '/blog')
60-
assertEquals(tree.map(({ url }) => url), ['/pages/blog.tsx', '/pages/blog/index.tsx'])
61-
})
55+
{
56+
const [router, chain] = routing.createRouter({ pathname: '/zh-CN/blog' })
57+
assertEquals(router.locale, 'zh-CN')
58+
assertEquals(router.pathname, '/blog')
59+
assertEquals(router.pagePath, '/blog')
60+
assertEquals(chain.map(({ url }) => url), ['/pages/blog.tsx', '/pages/blog/index.tsx'])
61+
}
6262

63-
Deno.test(`routing #06`, () => {
64-
const [router, tree] = routing.createRouter({ pathname: '/blog/hello-world' })
65-
assertEquals(router.pathname, '/blog/hello-world')
66-
assertEquals(router.pagePath, '/blog/[slug]')
67-
assertEquals(router.params, { slug: 'hello-world' })
68-
assertEquals(tree.map(({ url }) => url), ['/pages/blog.tsx', '/pages/blog/[slug].tsx'])
69-
})
63+
{
64+
const [router, chain] = routing.createRouter({ pathname: '/blog/hello-world' })
65+
assertEquals(router.pathname, '/blog/hello-world')
66+
assertEquals(router.pagePath, '/blog/[slug]')
67+
assertEquals(router.params, { slug: 'hello-world' })
68+
assertEquals(chain.map(({ url }) => url), ['/pages/blog.tsx', '/pages/blog/[slug].tsx'])
69+
}
7070

71-
Deno.test(`routing #07`, () => {
72-
const [router, tree] = routing.createRouter({ pathname: '/user' })
73-
assertEquals(router.pathname, '/user')
74-
assertEquals(router.pagePath, '/user')
75-
assertEquals(router.params, {})
76-
assertEquals(tree.map(({ url }) => url), ['/pages/user.tsx', '/pages/user/index.tsx'])
77-
})
71+
{
72+
const [router, chain] = routing.createRouter({ pathname: '/user' })
73+
assertEquals(router.pathname, '/user')
74+
assertEquals(router.pagePath, '/user')
75+
assertEquals(router.params, {})
76+
assertEquals(chain.map(({ url }) => url), ['/pages/user.tsx', '/pages/user/index.tsx'])
77+
}
7878

79-
Deno.test(`routing #08`, () => {
80-
const [router, tree] = routing.createRouter({ pathname: '/user/projects' })
81-
assertEquals(router.pathname, '/user/projects')
82-
assertEquals(router.pagePath, '/user/[...all]')
83-
assertEquals(router.params, { all: 'projects' })
84-
assertEquals(tree.map(({ url }) => url), ['/pages/user.tsx', '/pages/user/[...all].tsx'])
85-
})
79+
{
80+
const [router, chain] = routing.createRouter({ pathname: '/user/projects' })
81+
assertEquals(router.pathname, '/user/projects')
82+
assertEquals(router.pagePath, '/user/[...all]')
83+
assertEquals(router.params, { all: 'projects' })
84+
assertEquals(chain.map(({ url }) => url), ['/pages/user.tsx', '/pages/user/[...all].tsx'])
85+
}
8686

87-
Deno.test(`routing #09`, () => {
88-
const [router, tree] = routing.createRouter({ pathname: '/user/settings/profile' })
89-
assertEquals(router.pathname, '/user/settings/profile')
90-
assertEquals(router.pagePath, '/user/[...all]')
91-
assertEquals(router.params, { all: 'settings/profile' })
92-
assertEquals(tree.map(({ url }) => url), ['/pages/user.tsx', '/pages/user/[...all].tsx'])
93-
})
87+
{
88+
const [router, chain] = routing.createRouter({ pathname: '/user/settings/profile' })
89+
assertEquals(router.pathname, '/user/settings/profile')
90+
assertEquals(router.pagePath, '/user/[...all]')
91+
assertEquals(router.params, { all: 'settings/profile' })
92+
assertEquals(chain.map(({ url }) => url), ['/pages/user.tsx', '/pages/user/[...all].tsx'])
93+
}
9494

95-
Deno.test(`routing #10`, () => {
96-
const [router, tree] = routing.createRouter({ pathname: '/user/settings/security' })
97-
assertEquals(router.pathname, '/user/settings/security')
98-
assertEquals(router.pagePath, '/user/[...all]')
99-
assertEquals(router.params, { all: 'settings/security' })
100-
assertEquals(tree.map(({ url }) => url), ['/pages/user.tsx', '/pages/user/[...all].tsx'])
101-
})
95+
{
96+
const [router, chain] = routing.createRouter({ pathname: '/user/settings/security' })
97+
assertEquals(router.pathname, '/user/settings/security')
98+
assertEquals(router.pagePath, '/user/[...all]')
99+
assertEquals(router.params, { all: 'settings/security' })
100+
assertEquals(chain.map(({ url }) => url), ['/pages/user.tsx', '/pages/user/[...all].tsx'])
101+
}
102102

103-
Deno.test(`routing #11`, () => {
104-
const [router, tree] = routing.createRouter({ pathname: '/null' })
105-
assertEquals(router.pathname, '/null')
106-
assertEquals(router.pagePath, '')
107-
assertEquals(router.params, {})
108-
assertEquals(tree, [])
103+
{
104+
const [router, chain] = routing.createRouter({ pathname: '/null' })
105+
assertEquals(router.pathname, '/null')
106+
assertEquals(router.pagePath, '')
107+
assertEquals(router.params, {})
108+
assertEquals(chain, [])
109+
}
109110
})

plugins/sass_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { assertEquals } from 'https://deno.land/[email protected]/testing/asserts.ts'
22
import plugin from './sass.ts'
33

4-
Deno.test('project scss loader plugin', async () => {
4+
Deno.test('scss loader plugin', async () => {
55
const { code, format } = await plugin.transform(
66
(new TextEncoder).encode('$someVar: 123px; .some-selector { width: $someVar; }'),
77
'test.scss'
@@ -13,7 +13,7 @@ Deno.test('project scss loader plugin', async () => {
1313
assertEquals(format, 'css')
1414
})
1515

16-
Deno.test('project sass loader plugin', async () => {
16+
Deno.test('sass loader plugin', async () => {
1717
let ret = await plugin.transform(
1818
(new TextEncoder).encode('$someVar: 123px\n.some-selector\n width: 123px'),
1919
'test.sass'

plugins/wasm_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { assertEquals } from 'https://deno.land/[email protected]/testing/asserts.ts'
22
import plugin from './wasm.ts'
33

4-
Deno.test('project wasm loader plugin', async () => {
4+
Deno.test('wasm loader plugin', async () => {
55
const wasmBytes = new Uint8Array([
66
0, 97, 115, 109, 1, 0, 0, 0, 1, 133, 128, 128, 128, 0, 1, 96, 0, 1, 127,
77
3, 130, 128, 128, 128, 0, 1, 0, 4, 132, 128, 128, 128, 0, 1, 112, 0, 0,

server/multiparser_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { assertEquals } from 'https://deno.land/[email protected]/testing/asserts.ts'
2-
import { multiParser } from '../server/multiparser.ts'
2+
import { multiParser } from './multiparser.ts'
33

44
const encoder = new TextEncoder()
55

0 commit comments

Comments
 (0)