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 @@ -82,7 +82,16 @@ describe('MockDataGeneratorModal', () => {
82
82
getMockDataSchema : ( ) => {
83
83
return Promise . resolve ( {
84
84
content : {
85
- fields : [ ] ,
85
+ fields : [
86
+ {
87
+ fieldPath : 'name' ,
88
+ mongoType : 'string' ,
89
+ fakerMethod : 'person.firstName' ,
90
+ fakerArgs : [ ] ,
91
+ isArray : false ,
92
+ probability : 1.0 ,
93
+ } ,
94
+ ] ,
86
95
} ,
87
96
} as MockDataSchemaResponse ) ;
88
97
} ,
@@ -247,11 +256,11 @@ describe('MockDataGeneratorModal', () => {
247
256
await renderModal ( ) ;
248
257
249
258
expect ( screen . getByTestId ( 'raw-schema-confirmation' ) ) . to . exist ;
250
- expect ( screen . queryByTestId ( 'faker-schema-editor-loader ' ) ) . to . not . exist ;
259
+ expect ( screen . queryByTestId ( 'faker-schema-editor' ) ) . to . not . exist ;
251
260
userEvent . click ( screen . getByText ( 'Confirm' ) ) ;
252
261
await waitFor ( ( ) => {
253
262
expect ( screen . queryByTestId ( 'raw-schema-confirmation' ) ) . to . not . exist ;
254
- expect ( screen . getByTestId ( 'faker-schema-editor-loader ' ) ) . to . exist ;
263
+ expect ( screen . getByTestId ( 'faker-schema-editor' ) ) . to . exist ;
255
264
} ) ;
256
265
} ) ;
257
266
@@ -309,6 +318,20 @@ describe('MockDataGeneratorModal', () => {
309
318
} ) ;
310
319
311
320
it ( 'shows a loading spinner when the faker schema generation is in progress' , async ( ) => {
321
+ const mockServices = createMockServices ( ) ;
322
+ mockServices . atlasAiService . getMockDataSchema = ( ) =>
323
+ new Promise ( ( resolve ) =>
324
+ setTimeout (
325
+ ( ) =>
326
+ resolve ( {
327
+ content : {
328
+ fields : [ ] ,
329
+ } ,
330
+ } ) ,
331
+ 1000
332
+ )
333
+ ) ;
334
+
312
335
await renderModal ( ) ;
313
336
314
337
// advance to the schema editor step
You can’t perform that action at this time.
0 commit comments