@@ -32,33 +32,38 @@ const setFeatureFlag = (name: string, value: boolean) => {
3232 * regardless of whether trusted context has been defined by a state manager or not.
3333 * Integration tests have been used for extensive coverage of the LWC signals feature, but this particular
3434 * scenario is best isolated and unit tested as it involves manipulation of the trusted context API.
35+ * See bug fix: #5492
3536 */
3637describe ( 'mutation-tracker' , ( ) => {
37- it ( 'should not throw when componentValueObserved is called using the new signals validation and no signal set is defined' , ( ) => {
38- setFeatureFlag ( 'ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION' , false ) ;
39- expect ( ( ) => {
40- componentValueObserved ( mockVM , 'testKey' , { } ) ;
41- } ) . not . toThrow ( ) ;
42- } ) ;
38+ describe ( 'trustedSignal set not defined' , ( ) => {
39+ it ( 'should not throw when componentValueObserved is called using the new signals validation' , ( ) => {
40+ setFeatureFlag ( 'ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION' , false ) ;
41+ expect ( ( ) => {
42+ componentValueObserved ( mockVM , 'testKey' , { } ) ;
43+ } ) . not . toThrow ( ) ;
44+ } ) ;
4345
44- it ( 'should throw when componentValueObserved is called using legacy signals validation and no signal set has been defined' , ( ) => {
45- setFeatureFlag ( 'ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION' , true ) ;
46- expect ( ( ) => {
47- componentValueObserved ( mockVM , 'testKey' , { } ) ;
48- } ) . toThrow ( ) ;
46+ it ( 'should throw when componentValueObserved is called using legacy signals validation' , ( ) => {
47+ setFeatureFlag ( 'ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION' , true ) ;
48+ expect ( ( ) => {
49+ componentValueObserved ( mockVM , 'testKey' , { } ) ;
50+ } ) . toThrow ( ) ;
51+ } ) ;
4952 } ) ;
5053
51- it ( 'should not throw when a trusted signal set is defined abd componentValueObserved is called' , ( ) => {
52- setTrustedSignalSet ( new WeakSet ( ) ) ;
53- setFeatureFlag ( 'ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION' , false ) ;
54- expect ( ( ) => {
55- componentValueObserved ( mockVM , 'testKey' , { } ) ;
56- } ) . not . toThrow ( ) ;
54+ describe ( 'trustedSignal set defined' , ( ) => {
55+ it ( 'should not throw when componentValueObserved is called, regardless of validation type' , ( ) => {
56+ setTrustedSignalSet ( new WeakSet ( ) ) ;
57+ setFeatureFlag ( 'ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION' , false ) ;
58+ expect ( ( ) => {
59+ componentValueObserved ( mockVM , 'testKey' , { } ) ;
60+ } ) . not . toThrow ( ) ;
5761
58- setFeatureFlag ( 'ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION' , true ) ;
59- expect ( ( ) => {
60- componentValueObserved ( mockVM , 'testKey' , { } ) ;
61- } ) . not . toThrow ( ) ;
62+ setFeatureFlag ( 'ENABLE_LEGACY_SIGNAL_CONTEXT_VALIDATION' , true ) ;
63+ expect ( ( ) => {
64+ componentValueObserved ( mockVM , 'testKey' , { } ) ;
65+ } ) . not . toThrow ( ) ;
66+ } ) ;
6267 } ) ;
6368
6469 beforeAll ( ( ) => {
0 commit comments