@@ -25,16 +25,10 @@ import { type CollectionMetadata } from 'mongodb-collection-model';
2525import {
2626 SCHEMA_ANALYSIS_STATE_COMPLETE ,
2727 SCHEMA_ANALYSIS_STATE_INITIAL ,
28- SchemaAnalysisState ,
2928} from '../schema-analysis-types' ;
30- import {
31- MOCK_DATA_GENERATOR_REQUEST_COMPLETED ,
32- MOCK_DATA_GENERATOR_REQUEST_GENERATING ,
33- MOCK_DATA_GENERATOR_REQUEST_IDLE ,
34- MOCK_DATA_GENERATOR_REQUEST_ERROR ,
35- MockDataGeneratorState ,
36- MockDataGeneratorStep ,
37- } from '../components/mock-data-generator-modal/types' ;
29+ import type { SchemaAnalysisState } from '../schema-analysis-types' ;
30+ import { MockDataGeneratorStep } from '../components/mock-data-generator-modal/types' ;
31+ import type { MockDataGeneratorState } from '../components/mock-data-generator-modal/types' ;
3832import { CollectionActions } from '../modules/collection-tab' ;
3933import { type MockDataSchemaResponse } from '@mongodb-js/compass-generative-ai' ;
4034
@@ -330,7 +324,7 @@ describe('Collection Tab Content store', function () {
330324 validationRules : null ,
331325 } ,
332326 } ,
333- fakerSchemaGeneration : { status : MOCK_DATA_GENERATOR_REQUEST_IDLE } ,
327+ fakerSchemaGeneration : { status : 'idle' } ,
334328 } ) ;
335329 const logger = {
336330 log : { error : sandbox . spy ( ) } ,
@@ -348,14 +342,6 @@ describe('Collection Tab Content store', function () {
348342 fakerArgs : [ ] ,
349343 isArray : false ,
350344 } ,
351- {
352- fieldPath : 'age' ,
353- probability : 1.0 ,
354- mongoType : 'number' ,
355- fakerMethod : 'number.int' ,
356- fakerArgs : [ ] ,
357- isArray : false ,
358- } ,
359345 {
360346 fieldPath : 'isActive' ,
361347 probability : 1.0 ,
@@ -404,7 +390,7 @@ describe('Collection Tab Content store', function () {
404390 status : SCHEMA_ANALYSIS_STATE_COMPLETE ,
405391 processedSchema : undefined ,
406392 } ,
407- fakerSchemaGeneration : { status : MOCK_DATA_GENERATOR_REQUEST_IDLE } ,
393+ fakerSchemaGeneration : { status : 'idle' } ,
408394 } ) ;
409395 const logger = {
410396 log : { error : sandbox . spy ( ) } ,
@@ -445,7 +431,7 @@ describe('Collection Tab Content store', function () {
445431 const dispatch = sandbox . spy ( ) ;
446432 const getState = sandbox . stub ( ) . returns ( {
447433 schemaAnalysis : { status : SCHEMA_ANALYSIS_STATE_INITIAL } ,
448- fakerSchemaGeneration : { status : MOCK_DATA_GENERATOR_REQUEST_IDLE } ,
434+ fakerSchemaGeneration : { status : 'idle' } ,
449435 } ) ;
450436 const logger = {
451437 log : { error : sandbox . spy ( ) } ,
@@ -470,7 +456,7 @@ describe('Collection Tab Content store', function () {
470456 const getState = sandbox . stub ( ) . returns ( {
471457 schemaAnalysis : { status : SCHEMA_ANALYSIS_STATE_COMPLETE } ,
472458 fakerSchemaGeneration : {
473- status : MOCK_DATA_GENERATOR_REQUEST_GENERATING ,
459+ status : 'generating' ,
474460 } ,
475461 } ) ;
476462 const logger = {
@@ -503,7 +489,7 @@ describe('Collection Tab Content store', function () {
503489 isModalOpen : false ,
504490 currentStep : MockDataGeneratorStep . AI_DISCLAIMER ,
505491 } ,
506- fakerSchemaGeneration : { status : MOCK_DATA_GENERATOR_REQUEST_IDLE } ,
492+ fakerSchemaGeneration : { status : 'idle' } ,
507493 } ;
508494
509495 const completeSchemaState : SchemaAnalysisState = {
@@ -537,7 +523,7 @@ describe('Collection Tab Content store', function () {
537523 currentStep : MockDataGeneratorStep . SCHEMA_CONFIRMATION ,
538524 } ,
539525 fakerSchemaGeneration : {
540- status : MOCK_DATA_GENERATOR_REQUEST_GENERATING ,
526+ status : 'generating' ,
541527 requestId : 'existing_id' ,
542528 } ,
543529 } ,
@@ -549,7 +535,7 @@ describe('Collection Tab Content store', function () {
549535 currentStep : MockDataGeneratorStep . SCHEMA_CONFIRMATION ,
550536 } ,
551537 fakerSchemaGeneration : {
552- status : MOCK_DATA_GENERATOR_REQUEST_COMPLETED ,
538+ status : 'completed' ,
553539 fakerSchema : {
554540 content : {
555541 fields : [
@@ -583,13 +569,13 @@ describe('Collection Tab Content store', function () {
583569 isModalOpen : false ,
584570 currentStep : MockDataGeneratorStep . SCHEMA_CONFIRMATION ,
585571 } ,
586- fakerSchemaGeneration : { status : MOCK_DATA_GENERATOR_REQUEST_IDLE } ,
572+ fakerSchemaGeneration : { status : 'idle' } ,
587573 } ;
588574 const action = fakerMappingGenerationStartedAction ;
589575 const newState = collectionTabReducer ( state , action ) ;
590576
591577 expect ( newState . fakerSchemaGeneration ) . to . deep . equal ( {
592- status : MOCK_DATA_GENERATOR_REQUEST_GENERATING ,
578+ status : 'generating' ,
593579 requestId : 'some_request_id' ,
594580 } ) ;
595581
@@ -624,9 +610,9 @@ describe('Collection Tab Content store', function () {
624610
625611 it ( 'should not transition to completed if in idle, completed, or error state' , function ( ) {
626612 const noOpStates : MockDataGeneratorState [ ] = [
627- { status : MOCK_DATA_GENERATOR_REQUEST_IDLE } ,
613+ { status : 'idle' } ,
628614 {
629- status : MOCK_DATA_GENERATOR_REQUEST_COMPLETED ,
615+ status : 'completed' ,
630616 fakerSchema : {
631617 content : {
632618 fields : [
@@ -644,7 +630,7 @@ describe('Collection Tab Content store', function () {
644630 requestId : 'existing_id' ,
645631 } ,
646632 {
647- status : MOCK_DATA_GENERATOR_REQUEST_ERROR ,
633+ status : 'error' ,
648634 error : 'Some error' ,
649635 requestId : 'error_request_id' ,
650636 } ,
@@ -665,15 +651,15 @@ describe('Collection Tab Content store', function () {
665651 const state : CollectionState = {
666652 ...baseState ,
667653 fakerSchemaGeneration : {
668- status : MOCK_DATA_GENERATOR_REQUEST_GENERATING ,
654+ status : 'generating' ,
669655 requestId : 'generating_request_id' ,
670656 } ,
671657 } ;
672658 const action = fakerMappingGenerationCompletedAction ;
673659 const newState = collectionTabReducer ( state , action ) ;
674660
675661 expect ( newState . fakerSchemaGeneration ) . to . deep . equal ( {
676- status : MOCK_DATA_GENERATOR_REQUEST_COMPLETED ,
662+ status : 'completed' ,
677663 fakerSchema : action . fakerSchema ,
678664 requestId : action . requestId ,
679665 } ) ;
@@ -698,9 +684,9 @@ describe('Collection Tab Content store', function () {
698684
699685 it ( 'should not transition to error if in idle, completed, or error state' , function ( ) {
700686 const noOpStates : MockDataGeneratorState [ ] = [
701- { status : MOCK_DATA_GENERATOR_REQUEST_IDLE } ,
687+ { status : 'idle' } ,
702688 {
703- status : MOCK_DATA_GENERATOR_REQUEST_COMPLETED ,
689+ status : 'completed' ,
704690 fakerSchema : {
705691 content : {
706692 fields : [
@@ -718,7 +704,7 @@ describe('Collection Tab Content store', function () {
718704 requestId : 'existing_id' ,
719705 } ,
720706 {
721- status : MOCK_DATA_GENERATOR_REQUEST_ERROR ,
707+ status : 'error' ,
722708 error : 'Previous error' ,
723709 requestId : 'error_request_id' ,
724710 } ,
@@ -739,15 +725,15 @@ describe('Collection Tab Content store', function () {
739725 const state : CollectionState = {
740726 ...baseState ,
741727 fakerSchemaGeneration : {
742- status : MOCK_DATA_GENERATOR_REQUEST_GENERATING ,
728+ status : 'generating' ,
743729 requestId : 'generating_request_id' ,
744730 } ,
745731 } ;
746732 const action = fakerMappingGenerationFailedAction ;
747733 const newState = collectionTabReducer ( state , action ) ;
748734
749735 expect ( newState . fakerSchemaGeneration ) . to . deep . equal ( {
750- status : MOCK_DATA_GENERATOR_REQUEST_ERROR ,
736+ status : 'error' ,
751737 error : action . error ,
752738 requestId : action . requestId ,
753739 } ) ;
0 commit comments