|
1 |
| -import { describe, expect } from 'vitest' |
| 1 | +import { describe, expect, it } from 'vitest' |
2 | 2 | import type { UserPagesConfig } from '../packages/core/src'
|
3 | 3 | import { PageContext } from '../packages/core/src'
|
4 | 4 |
|
@@ -172,4 +172,46 @@ describe('generate routes', () => {
|
172 | 172 | ]"
|
173 | 173 | `)
|
174 | 174 | })
|
| 175 | + |
| 176 | + it('fix subPackage cannot match the second-level dir', async () => { |
| 177 | + const ctx = new PageContext({ |
| 178 | + subPackages: [ |
| 179 | + 'packages/playground/src/pages-sub-pages/sub-activity', |
| 180 | + 'packages/playground/src/pages-sub-pages/sub-main', |
| 181 | + ], |
| 182 | + }) |
| 183 | + await ctx.scanSubPages() |
| 184 | + await ctx.mergeSubPageMetaData() |
| 185 | + const routes = ctx.resolveSubRoutes() |
| 186 | + expect(routes).toMatchInlineSnapshot(` |
| 187 | + "[ |
| 188 | + { |
| 189 | + "root": "../packages/playground/src/pages-sub-pages/sub-activity", |
| 190 | + "pages": [ |
| 191 | + { |
| 192 | + "path": "pages/about/index", |
| 193 | + "type": "page" |
| 194 | + }, |
| 195 | + { |
| 196 | + "path": "pages/home/index", |
| 197 | + "type": "page" |
| 198 | + } |
| 199 | + ] |
| 200 | + }, |
| 201 | + { |
| 202 | + "root": "../packages/playground/src/pages-sub-pages/sub-main", |
| 203 | + "pages": [ |
| 204 | + { |
| 205 | + "path": "pages/about/index", |
| 206 | + "type": "page" |
| 207 | + }, |
| 208 | + { |
| 209 | + "path": "pages/home/index", |
| 210 | + "type": "page" |
| 211 | + } |
| 212 | + ] |
| 213 | + } |
| 214 | + ]" |
| 215 | + `) |
| 216 | + }) |
175 | 217 | })
|
0 commit comments