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', () => {
8282 getMockDataSchema : ( ) => {
8383 return Promise . resolve ( {
8484 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+ ] ,
8695 } ,
8796 } as MockDataSchemaResponse ) ;
8897 } ,
@@ -247,11 +256,11 @@ describe('MockDataGeneratorModal', () => {
247256 await renderModal ( ) ;
248257
249258 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 ;
251260 userEvent . click ( screen . getByText ( 'Confirm' ) ) ;
252261 await waitFor ( ( ) => {
253262 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 ;
255264 } ) ;
256265 } ) ;
257266
@@ -309,6 +318,20 @@ describe('MockDataGeneratorModal', () => {
309318 } ) ;
310319
311320 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+
312335 await renderModal ( ) ;
313336
314337 // advance to the schema editor step
You can’t perform that action at this time.
0 commit comments