Skip to content

Commit 094aeb8

Browse files
chore: simplified shadow test
1 parent 24dcf50 commit 094aeb8

File tree

1 file changed

+8
-5
lines changed
  • packages/@lwc/integration-karma/test-hydration/context

1 file changed

+8
-5
lines changed

packages/@lwc/integration-karma/test-hydration/context/index.spec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default {
3636
assertContextDisconnected(target, snapshot);
3737

3838
// Expect an error as one context was generated twice.
39-
// Context values are expected to be rendered (there should be no hydration warnings)
39+
// Expect server/client context output parity (no hydration warnings)
4040
TestUtils.expectConsoleCalls(consoleCalls, {
4141
error: [
4242
'Multiple contexts of the same variety were provided. Only the first context will be used.',
@@ -68,15 +68,18 @@ function assertContextShadowed(snapshot) {
6868

6969
expect(childOfFirstParentContext.providedContextSignal)
7070
.withContext(
71-
`${snapshot.components.childOfFirstParent.tagName} should have been provided with the parent's context and not that of the grandparent`
71+
`Child should have been provided with the parent context and not that of the grandparent (grandparent context was shadowed)`
7272
)
7373
.toBe(firstParentContext);
7474

7575
expect(firstParentContext.providedContextSignal)
76-
.withContext(
77-
`${snapshot.components.firstParent.tagName} should have been provided with the parent's context and not that of the grandparent`
78-
)
76+
.withContext(`Parent should have been provided with grandparent context`)
7977
.toBe(grandparentContext);
78+
79+
// For good measure
80+
expect(grandparentContext)
81+
.withContext(`Grandparent context should not be the same as the parent context`)
82+
.not.toBe(firstParentContext);
8083
}
8184

8285
function assertContextDisconnected(target, snapshot) {

0 commit comments

Comments
 (0)