@@ -16,6 +16,8 @@ import {
16
16
import { DirtyLevels } from '../src/constants'
17
17
import { COMPUTED_SIDE_EFFECT_WARN } from '../src/computed'
18
18
19
+ const normalizedSideEffectWarn = `[Vue warn] ${ COMPUTED_SIDE_EFFECT_WARN } `
20
+
19
21
describe ( 'reactivity/computed' , ( ) => {
20
22
it ( 'should return updated value' , ( ) => {
21
23
const value = reactive < { foo ?: number } > ( { } )
@@ -489,7 +491,7 @@ describe('reactivity/computed', () => {
489
491
expect ( c3 . effect . _dirtyLevel ) . toBe (
490
492
DirtyLevels . MaybeDirty_ComputedSideEffect ,
491
493
)
492
- expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
494
+ expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
493
495
} )
494
496
495
497
it ( 'should work when chained(ref+computed)' , ( ) => {
@@ -504,7 +506,7 @@ describe('reactivity/computed', () => {
504
506
expect ( c2 . value ) . toBe ( '0foo' )
505
507
expect ( c2 . effect . _dirtyLevel ) . toBe ( DirtyLevels . Dirty )
506
508
expect ( c2 . value ) . toBe ( '1foo' )
507
- expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
509
+ expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
508
510
} )
509
511
510
512
it ( 'should trigger effect even computed already dirty' , ( ) => {
@@ -527,7 +529,7 @@ describe('reactivity/computed', () => {
527
529
expect ( c2 . effect . _dirtyLevel ) . toBe ( DirtyLevels . Dirty )
528
530
v . value = 2
529
531
expect ( fnSpy ) . toBeCalledTimes ( 2 )
530
- expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
532
+ expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
531
533
} )
532
534
533
535
// #10185
@@ -571,7 +573,7 @@ describe('reactivity/computed', () => {
571
573
expect ( c3 . effect . _dirtyLevel ) . toBe ( DirtyLevels . MaybeDirty )
572
574
573
575
expect ( c3 . value ) . toBe ( 'yes' )
574
- expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
576
+ expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
575
577
} )
576
578
577
579
it ( 'should be not dirty after deps mutate (mutate deps in computed)' , async ( ) => {
@@ -593,7 +595,7 @@ describe('reactivity/computed', () => {
593
595
await nextTick ( )
594
596
await nextTick ( )
595
597
expect ( serializeInner ( root ) ) . toBe ( `2` )
596
- expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
598
+ expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
597
599
} )
598
600
599
601
it ( 'should not trigger effect scheduler by recurse computed effect' , async ( ) => {
@@ -616,6 +618,6 @@ describe('reactivity/computed', () => {
616
618
v . value += ' World'
617
619
await nextTick ( )
618
620
expect ( serializeInner ( root ) ) . toBe ( 'Hello World World World World' )
619
- expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
621
+ expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
620
622
} )
621
623
} )
0 commit comments