@@ -16,8 +16,6 @@ import {
1616import { DirtyLevels } from '../src/constants'
1717import { COMPUTED_SIDE_EFFECT_WARN } from '../src/computed'
1818
19- const normalizedSideEffectWarn = `[Vue warn] ${ COMPUTED_SIDE_EFFECT_WARN } `
20-
2119describe ( 'reactivity/computed' , ( ) => {
2220 it ( 'should return updated value' , ( ) => {
2321 const value = reactive < { foo ?: number } > ( { } )
@@ -491,7 +489,7 @@ describe('reactivity/computed', () => {
491489 expect ( c3 . effect . _dirtyLevel ) . toBe (
492490 DirtyLevels . MaybeDirty_ComputedSideEffect ,
493491 )
494- expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
492+ expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
495493 } )
496494
497495 it ( 'should work when chained(ref+computed)' , ( ) => {
@@ -506,7 +504,7 @@ describe('reactivity/computed', () => {
506504 expect ( c2 . value ) . toBe ( '0foo' )
507505 expect ( c2 . effect . _dirtyLevel ) . toBe ( DirtyLevels . Dirty )
508506 expect ( c2 . value ) . toBe ( '1foo' )
509- expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
507+ expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
510508 } )
511509
512510 it ( 'should trigger effect even computed already dirty' , ( ) => {
@@ -529,7 +527,7 @@ describe('reactivity/computed', () => {
529527 expect ( c2 . effect . _dirtyLevel ) . toBe ( DirtyLevels . Dirty )
530528 v . value = 2
531529 expect ( fnSpy ) . toBeCalledTimes ( 2 )
532- expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
530+ expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
533531 } )
534532
535533 // #10185
@@ -573,7 +571,7 @@ describe('reactivity/computed', () => {
573571 expect ( c3 . effect . _dirtyLevel ) . toBe ( DirtyLevels . MaybeDirty )
574572
575573 expect ( c3 . value ) . toBe ( 'yes' )
576- expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
574+ expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
577575 } )
578576
579577 it ( 'should be not dirty after deps mutate (mutate deps in computed)' , async ( ) => {
@@ -595,7 +593,7 @@ describe('reactivity/computed', () => {
595593 await nextTick ( )
596594 await nextTick ( )
597595 expect ( serializeInner ( root ) ) . toBe ( `2` )
598- expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
596+ expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
599597 } )
600598
601599 it ( 'should not trigger effect scheduler by recurse computed effect' , async ( ) => {
@@ -618,6 +616,6 @@ describe('reactivity/computed', () => {
618616 v . value += ' World'
619617 await nextTick ( )
620618 expect ( serializeInner ( root ) ) . toBe ( 'Hello World World World World' )
621- expect ( normalizedSideEffectWarn ) . toHaveBeenWarned ( )
619+ expect ( COMPUTED_SIDE_EFFECT_WARN ) . toHaveBeenWarned ( )
622620 } )
623621} )
0 commit comments