File tree Expand file tree Collapse file tree 1 file changed +26
-3
lines changed
packages/compass-collection/src/components/mock-data-generator-modal Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,16 @@ describe('MockDataGeneratorModal', () => {
75
75
getMockDataSchema : ( ) => {
76
76
return Promise . resolve ( {
77
77
content : {
78
- fields : [ ] ,
78
+ fields : [
79
+ {
80
+ fieldPath : 'name' ,
81
+ mongoType : 'string' ,
82
+ fakerMethod : 'person.firstName' ,
83
+ fakerArgs : [ ] ,
84
+ isArray : false ,
85
+ probability : 1.0 ,
86
+ } ,
87
+ ] ,
79
88
} ,
80
89
} as MockDataSchemaResponse ) ;
81
90
} ,
@@ -209,11 +218,11 @@ describe('MockDataGeneratorModal', () => {
209
218
await renderModal ( ) ;
210
219
211
220
expect ( screen . getByTestId ( 'raw-schema-confirmation' ) ) . to . exist ;
212
- expect ( screen . queryByTestId ( 'faker-schema-editor-loader ' ) ) . to . not . exist ;
221
+ expect ( screen . queryByTestId ( 'faker-schema-editor' ) ) . to . not . exist ;
213
222
userEvent . click ( screen . getByText ( 'Confirm' ) ) ;
214
223
await waitFor ( ( ) => {
215
224
expect ( screen . queryByTestId ( 'raw-schema-confirmation' ) ) . to . not . exist ;
216
- expect ( screen . getByTestId ( 'faker-schema-editor-loader ' ) ) . to . exist ;
225
+ expect ( screen . getByTestId ( 'faker-schema-editor' ) ) . to . exist ;
217
226
} ) ;
218
227
} ) ;
219
228
@@ -272,6 +281,20 @@ describe('MockDataGeneratorModal', () => {
272
281
} ) ;
273
282
274
283
it ( 'shows a loading spinner when the faker schema generation is in progress' , async ( ) => {
284
+ const mockServices = createMockServices ( ) ;
285
+ mockServices . atlasAiService . getMockDataSchema = ( ) =>
286
+ new Promise ( ( resolve ) =>
287
+ setTimeout (
288
+ ( ) =>
289
+ resolve ( {
290
+ content : {
291
+ fields : [ ] ,
292
+ } ,
293
+ } ) ,
294
+ 1000
295
+ )
296
+ ) ;
297
+
275
298
await renderModal ( ) ;
276
299
277
300
// advance to the schema editor step
You can’t perform that action at this time.
0 commit comments