Skip to content

Commit 82a13bb

Browse files
committed
chore: simplify unit test
1 parent 13995cb commit 82a13bb

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/runtime-core/__tests__/components/Suspense.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,13 +2365,13 @@ describe('Suspense', () => {
23652365
const CompAsyncSetup = defineAsyncComponent({
23662366
props: ['item', 'id'],
23672367
render(ctx: any) {
2368-
return h('div', ctx.id + '--' + ctx.item.name)
2368+
return h('div', ctx.id + '-' + ctx.item.name)
23692369
},
23702370
})
23712371
const items = ref([
2372-
{ id: 1, name: '111' },
2373-
{ id: 2, name: '222' },
2374-
{ id: 3, name: '333' },
2372+
{ id: 1, name: 'a' },
2373+
{ id: 2, name: 'b' },
2374+
{ id: 3, name: 'c' },
23752375
])
23762376
const Comp = {
23772377
props: ['id'],
@@ -2386,7 +2386,7 @@ describe('Suspense', () => {
23862386
h(CompAsyncSetup, {
23872387
item,
23882388
key: item.id,
2389-
id: 'foo:' + props.id,
2389+
id: props.id,
23902390
}),
23912391
),
23922392
),
@@ -2431,27 +2431,27 @@ describe('Suspense', () => {
24312431
await Promise.all(deps)
24322432

24332433
expect(serializeInner(root)).toBe(
2434-
`<div>foo:1--111</div><div>foo:1--222</div><div>foo:1--333</div><div>foo:2--111</div><div>foo:2--222</div><div>foo:2--333</div><div>foo:3--111</div><div>foo:3--222</div><div>foo:3--333</div>`,
2434+
`<div>1-a</div><div>1-b</div><div>1-c</div><div>2-a</div><div>2-b</div><div>2-c</div><div>3-a</div><div>3-b</div><div>3-c</div>`,
24352435
)
24362436

24372437
list.value = [{ id: 4 }, { id: 5 }, { id: 6 }]
24382438
await nextTick()
24392439
await Promise.all(deps)
24402440
await Promise.all(deps)
24412441
expect(serializeInner(root)).toBe(
2442-
`<div>foo:4--111</div><div>foo:4--222</div><div>foo:4--333</div><div>foo:5--111</div><div>foo:5--222</div><div>foo:5--333</div><div>foo:6--111</div><div>foo:6--222</div><div>foo:6--333</div>`,
2442+
`<div>4-a</div><div>4-b</div><div>4-c</div><div>5-a</div><div>5-b</div><div>5-c</div><div>6-a</div><div>6-b</div><div>6-c</div>`,
24432443
)
24442444

24452445
items.value = [
2446-
{ id: 4, name: '444' },
2447-
{ id: 5, name: '555' },
2448-
{ id: 6, name: '666' },
2446+
{ id: 4, name: 'd' },
2447+
{ id: 5, name: 'f' },
2448+
{ id: 6, name: 'g' },
24492449
]
24502450
await nextTick()
24512451
await Promise.all(deps)
24522452
await Promise.all(deps)
24532453
expect(serializeInner(root)).toBe(
2454-
`<div>foo:4--444</div><div>foo:4--555</div><div>foo:4--666</div><div>foo:5--444</div><div>foo:5--555</div><div>foo:5--666</div><div>foo:6--444</div><div>foo:6--555</div><div>foo:6--666</div>`,
2454+
`<div>4-d</div><div>4-f</div><div>4-g</div><div>5-d</div><div>5-f</div><div>5-g</div><div>6-d</div><div>6-f</div><div>6-g</div>`,
24552455
)
24562456
})
24572457

0 commit comments

Comments
 (0)