@@ -440,7 +440,7 @@ describe('AtlasUserData', function () {
440440 validatorOpts : ValidatorOptions = { } ,
441441 orgId = 'test-org' ,
442442 groupId = 'test-group' ,
443- type = 'favorites'
443+ type : 'favorites' | 'recents' | 'pipelines' = 'favorites'
444444 ) => {
445445 return new AtlasUserData (
446446 getTestSchema ( validatorOpts ) ,
@@ -613,7 +613,7 @@ describe('AtlasUserData', function () {
613613 const result = await userData . readAll ( ) ;
614614
615615 expect ( result . data ) . to . have . lengthOf ( 0 ) ;
616- expect ( result . errors ) . to . have . lengthOf ( 0 ) ;
616+ expect ( result . errors ) . to . have . lengthOf ( 1 ) ;
617617 } ) ;
618618
619619 it ( 'handles errors gracefully' , async function ( ) {
@@ -703,11 +703,7 @@ describe('AtlasUserData', function () {
703703 hasDarkMode : false ,
704704 } ) ;
705705
706- expect ( result ) . to . deep . equal ( {
707- ...defaultValues ( ) ,
708- name : 'Updated Name' ,
709- hasDarkMode : false ,
710- } ) ;
706+ expect ( result ) . equals ( true ) ;
711707
712708 expect ( authenticatedFetchStub ) . to . have . been . calledOnce ;
713709 const [ url , options ] = authenticatedFetchStub . firstCall . args ;
@@ -718,18 +714,15 @@ describe('AtlasUserData', function () {
718714 expect ( options . headers [ 'Content-Type' ] ) . to . equal ( 'application/json' ) ;
719715 } ) ;
720716
721- it ( 'throws error when response is not ok' , async function ( ) {
717+ it ( 'returns false when response is not ok' , async function ( ) {
722718 authenticatedFetchStub . resolves ( mockResponse ( { } , false , 400 ) ) ;
723719
724720 const userData = getAtlasUserData ( ) ;
725721
726- try {
727- await userData . updateAttributes ( 'test-id' , { name : 'Updated' } ) ;
728- expect . fail ( 'Should have thrown error' ) ;
729- } catch ( error ) {
730- expect ( error ) . to . be . instanceOf ( Error ) ;
731- expect ( ( error as Error ) . message ) . to . contain ( 'Failed to update data' ) ;
732- }
722+ const result = await userData . updateAttributes ( 'test-id' , {
723+ name : 'Updated' ,
724+ } ) ;
725+ expect ( result ) . equals ( false ) ;
733726 } ) ;
734727
735728 it ( 'uses custom serializer for request body' , async function ( ) {
@@ -807,12 +800,12 @@ describe('AtlasUserData', function () {
807800 it ( 'constructs URL correctly for different types' , async function ( ) {
808801 authenticatedFetchStub . resolves ( mockResponse ( { } ) ) ;
809802
810- const userData = getAtlasUserData ( { } , 'org123' , 'group456' , 'recent ' ) ;
803+ const userData = getAtlasUserData ( { } , 'org123' , 'group456' , 'recents ' ) ;
811804 await userData . write ( 'item789' , { name : 'Recent Item' } ) ;
812805
813806 const [ url ] = authenticatedFetchStub . firstCall . args ;
814807 expect ( url ) . to . equal (
815- 'cluster-connection.cloud-local.mongodb.com/recent /org123/group456'
808+ 'cluster-connection.cloud-local.mongodb.com/recents /org123/group456'
816809 ) ;
817810 } ) ;
818811 } ) ;
0 commit comments