@@ -3,6 +3,7 @@ import { mount } from 'enzyme';
33import { expect } from 'chai' ;
44import sinon from 'sinon' ;
55import { ZeroState } from 'hadron-react-components' ;
6+ import { Banner , WarningSummary } from '@mongodb-js/compass-components' ;
67
78import ValidationStates from '../validation-states' ;
89import ValidationEditor from '../validation-editor' ;
@@ -65,15 +66,17 @@ describe('ValidationStates [Component]', function () {
6566 } ) ;
6667
6768 it ( 'renders the version banner' , function ( ) {
68- expect ( component . find ( { id : 'oldServerReadOnly' } ) ) . to . be . present ( ) ;
69+ expect (
70+ component . find ( { [ 'data-testid' ] : 'old-server-read-only' } )
71+ ) . to . be . present ( ) ;
6972 } ) ;
7073
7174 it ( 'does not render other banners' , function ( ) {
72- expect ( component . find ( { id : 'collectionReadOnly' } ) ) . to . be . not . present ( ) ;
73- expect ( component . find ( { id : 'hadronReadOnly' } ) ) . to . be . not . present ( ) ;
7475 expect (
75- component . find ( { id : 'writeStateStoreReadOnly' } )
76- ) . to . be . not . present ( ) ;
76+ component . find ( {
77+ [ 'data-testid' ] : 'collection-validation-warning' ,
78+ } )
79+ ) . to . not . be . present ( ) ;
7780 } ) ;
7881 } ) ;
7982
@@ -94,7 +97,21 @@ describe('ValidationStates [Component]', function () {
9497 } ) ;
9598
9699 it ( 'renders the collection time-series banner' , function ( ) {
97- expect ( component . find ( { id : 'collectionTimeSeries' } ) ) . to . be . present ( ) ;
100+ expect (
101+ component . find ( {
102+ [ 'data-testid' ] : 'collection-validation-warning' ,
103+ } )
104+ ) . to . be . present ( ) ;
105+ expect (
106+ component
107+ . find ( {
108+ [ 'data-testid' ] : 'collection-validation-warning' ,
109+ } )
110+ . at ( 0 )
111+ . text ( )
112+ ) . to . equal (
113+ 'Schema validation for time-series collections is not supported.'
114+ ) ;
98115 } ) ;
99116 } ) ;
100117
@@ -114,14 +131,24 @@ describe('ValidationStates [Component]', function () {
114131 } ) ;
115132
116133 it ( 'renders the collection read-only banner' , function ( ) {
117- expect ( component . find ( { id : 'collectionReadOnly' } ) ) . to . be . present ( ) ;
134+ expect (
135+ component . find ( {
136+ [ 'data-testid' ] : 'collection-validation-warning' ,
137+ } )
138+ ) . to . be . present ( ) ;
139+ expect (
140+ component
141+ . find ( {
142+ [ 'data-testid' ] : 'collection-validation-warning' ,
143+ } )
144+ . at ( 0 )
145+ . text ( )
146+ ) . to . equal ( 'Schema validation for readonly views is not supported.' ) ;
118147 } ) ;
119148
120149 it ( 'does not render other banners' , function ( ) {
121- expect ( component . find ( { id : 'oldServerReadOnly' } ) ) . to . be . not . present ( ) ;
122- expect ( component . find ( { id : 'hadronReadOnly' } ) ) . to . be . not . present ( ) ;
123150 expect (
124- component . find ( { id : 'writeStateStoreReadOnly ' } )
151+ component . find ( { [ 'data-testid' ] : 'old-server-read-only ' } )
125152 ) . to . be . not . present ( ) ;
126153 } ) ;
127154 } ) ;
@@ -142,7 +169,8 @@ describe('ValidationStates [Component]', function () {
142169 } ) ;
143170
144171 it ( 'does not render a warning banner' , function ( ) {
145- expect ( component . find ( 'StatusRow' ) ) . to . be . not . present ( ) ;
172+ expect ( component . find ( Banner ) ) . to . be . not . present ( ) ;
173+ expect ( component . find ( WarningSummary ) ) . to . be . not . present ( ) ;
146174 } ) ;
147175 } ) ;
148176
@@ -162,7 +190,8 @@ describe('ValidationStates [Component]', function () {
162190 } ) ;
163191
164192 it ( 'does not render a warning banner' , function ( ) {
165- expect ( component . find ( 'StatusRow' ) ) . to . be . not . present ( ) ;
193+ expect ( component . find ( Banner ) ) . to . be . not . present ( ) ;
194+ expect ( component . find ( WarningSummary ) ) . to . be . not . present ( ) ;
166195 } ) ;
167196 } ) ;
168197
@@ -182,13 +211,25 @@ describe('ValidationStates [Component]', function () {
182211 } ) ;
183212
184213 it ( 'renders the writable banner' , function ( ) {
185- expect ( component . find ( { id : 'writeStateStoreReadOnly' } ) ) . to . be . present ( ) ;
214+ expect (
215+ component . find ( {
216+ [ 'data-testid' ] : 'collection-validation-warning' ,
217+ } )
218+ ) . to . be . present ( ) ;
219+ expect (
220+ component
221+ . find ( {
222+ [ 'data-testid' ] : 'collection-validation-warning' ,
223+ } )
224+ . at ( 0 )
225+ . text ( )
226+ ) . to . equal ( 'This action is not available on a secondary node.' ) ;
186227 } ) ;
187228
188229 it ( 'does not render other banners' , function ( ) {
189- expect ( component . find ( { id : 'collectionReadOnly' } ) ) . to . be . not . present ( ) ;
190- expect ( component . find ( { id : 'hadronReadOnly ' } ) ) . to . be . not . present ( ) ;
191- expect ( component . find ( { id : 'oldServerReadOnly' } ) ) . to . be . not . present ( ) ;
230+ expect (
231+ component . find ( { [ 'data-testid' ] : 'old-server-read-only ' } )
232+ ) . to . be . not . present ( ) ;
192233 } ) ;
193234 } ) ;
194235
0 commit comments