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', () => {
7575 getMockDataSchema : ( ) => {
7676 return Promise . resolve ( {
7777 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+ ] ,
7988 } ,
8089 } as MockDataSchemaResponse ) ;
8190 } ,
@@ -209,11 +218,11 @@ describe('MockDataGeneratorModal', () => {
209218 await renderModal ( ) ;
210219
211220 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 ;
213222 userEvent . click ( screen . getByText ( 'Confirm' ) ) ;
214223 await waitFor ( ( ) => {
215224 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 ;
217226 } ) ;
218227 } ) ;
219228
@@ -272,6 +281,20 @@ describe('MockDataGeneratorModal', () => {
272281 } ) ;
273282
274283 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+
275298 await renderModal ( ) ;
276299
277300 // advance to the schema editor step
You can’t perform that action at this time.
0 commit comments