@@ -419,111 +419,111 @@ describe('user-data', function () {
419
419
} ) ;
420
420
} ) ;
421
421
422
- describe ( 'AtlasUserData' , function ( ) {
423
- let AtlasUserData : any ;
424
- let atlasServiceMock : any ;
425
- let validator : any ;
426
- let instance : any ;
427
-
428
- before ( async function ( ) {
429
- // Dynamically import AtlasUserData to avoid circular deps
430
- const module = await import ( './user-data' ) ;
431
- AtlasUserData = module . AtlasUserData ;
432
- validator = getTestSchema ( ) ;
433
- } ) ;
434
-
435
- beforeEach ( function ( ) {
436
- atlasServiceMock = {
437
- authenticatedFetch : sinon . stub ( ) ,
438
- } ;
439
- instance = new AtlasUserData ( validator , atlasServiceMock , {
440
- groupId : 'test-group' ,
441
- projectId : 'test-project' ,
442
- endpoint : '/api/user-data' ,
443
- } ) ;
444
- } ) ;
445
-
446
- it ( 'constructs with dependencies' , function ( ) {
447
- expect ( instance ) . to . have . property ( 'atlasService' , atlasServiceMock ) ;
448
- expect ( instance ) . to . have . property ( 'groupId' , 'test-group' ) ;
449
- expect ( instance ) . to . have . property ( 'projectId' , 'test-project' ) ;
450
- expect ( instance ) . to . have . property ( 'endpoint' , '/api/user-data' ) ;
451
- } ) ;
452
-
453
- it ( 'write: calls authenticatedFetch and validates response' , async function ( ) {
454
- const item = { name : 'Atlas' , hasDarkMode : false } ;
455
- atlasServiceMock . authenticatedFetch . resolves ( {
456
- ok : true ,
457
- json : async ( ) => await Promise . resolve ( item ) ,
458
- } ) ;
459
- const result = await instance . write ( 'id1' , item ) ;
460
- expect ( result ) . to . be . true ;
461
- expect ( atlasServiceMock . authenticatedFetch . calledOnce ) . to . be . true ;
462
- } ) ;
463
-
464
- it ( 'write: handles API error' , async function ( ) {
465
- atlasServiceMock . authenticatedFetch . resolves ( { ok : false , status : 500 } ) ;
466
- const result = await instance . write ( 'id1' , { name : 'Atlas' } ) ;
467
- expect ( result ) . to . be . false ;
468
- } ) ;
469
-
470
- it ( 'delete: calls authenticatedFetch and returns true on success' , async function ( ) {
471
- atlasServiceMock . authenticatedFetch . resolves ( { ok : true } ) ;
472
- const result = await instance . delete ( 'id1' ) ;
473
- expect ( result ) . to . be . true ;
474
- } ) ;
475
-
476
- it ( 'delete: returns false on API failure' , async function ( ) {
477
- atlasServiceMock . authenticatedFetch . resolves ( { ok : false } ) ;
478
- const result = await instance . delete ( 'id1' ) ;
479
- expect ( result ) . to . be . false ;
480
- } ) ;
481
-
482
- it ( 'readAll: returns validated items from API' , async function ( ) {
483
- const items = [
484
- { name : 'Atlas' , hasDarkMode : true } ,
485
- { name : 'Compass' , hasDarkMode : false } ,
486
- ] ;
487
- atlasServiceMock . authenticatedFetch . resolves ( {
488
- ok : true ,
489
- json : async ( ) => await Promise . resolve ( items ) ,
490
- } ) ;
491
- const result = await instance . readAll ( ) ;
492
- expect ( result . data ) . to . have . lengthOf ( 2 ) ;
493
- expect ( result . errors ) . to . have . lengthOf ( 0 ) ;
494
- expect ( result . data [ 0 ] ) . to . have . property ( 'name' ) ;
495
- } ) ;
496
-
497
- it ( 'readAll: returns errors for invalid items' , async function ( ) {
498
- const items = [
499
- { name : 'Atlas' , hasDarkMode : 'not-a-bool' } ,
500
- { name : 'Compass' , hasDarkMode : false } ,
501
- ] ;
502
- atlasServiceMock . authenticatedFetch . resolves ( {
503
- ok : true ,
504
- json : async ( ) => await Promise . resolve ( items ) ,
505
- } ) ;
506
- const result = await instance . readAll ( ) ;
507
- expect ( result . data ) . to . have . lengthOf ( 1 ) ;
508
- expect ( result . errors ) . to . have . lengthOf ( 1 ) ;
509
- } ) ;
510
-
511
- it ( 'updateAttributes: calls authenticatedFetch and validates response' , async function ( ) {
512
- const attrs = { hasDarkMode : false } ;
513
- atlasServiceMock . authenticatedFetch . resolves ( {
514
- ok : true ,
515
- json : async ( ) =>
516
- await Promise . resolve ( { name : 'Atlas' , hasDarkMode : false } ) ,
517
- } ) ;
518
- const result = await instance . updateAttributes ( 'id1' , attrs ) ;
519
- expect ( result ) . to . deep . equal ( { name : 'Atlas' , hasDarkMode : false } ) ;
520
- } ) ;
521
-
522
- it ( 'updateAttributes: returns undefined on API error' , async function ( ) {
523
- atlasServiceMock . authenticatedFetch . resolves ( { ok : false } ) ;
524
- const result = await instance . updateAttributes ( 'id1' , {
525
- hasDarkMode : true ,
526
- } ) ;
527
- expect ( result ) . to . be . undefined ;
528
- } ) ;
529
- } ) ;
422
+ // describe('AtlasUserData', function () {
423
+ // let AtlasUserData: any;
424
+ // let atlasServiceMock: any;
425
+ // let validator: any;
426
+ // let instance: any;
427
+
428
+ // before(async function () {
429
+ // // Dynamically import AtlasUserData to avoid circular deps
430
+ // const module = await import('./user-data');
431
+ // AtlasUserData = module.AtlasUserData;
432
+ // validator = getTestSchema();
433
+ // });
434
+
435
+ // beforeEach(function () {
436
+ // atlasServiceMock = {
437
+ // authenticatedFetch: sinon.stub(),
438
+ // };
439
+ // instance = new AtlasUserData(validator, atlasServiceMock, {
440
+ // groupId: 'test-group',
441
+ // projectId: 'test-project',
442
+ // endpoint: '/api/user-data',
443
+ // });
444
+ // });
445
+
446
+ // it('constructs with dependencies', function () {
447
+ // expect(instance).to.have.property('atlasService', atlasServiceMock);
448
+ // expect(instance).to.have.property('groupId', 'test-group');
449
+ // expect(instance).to.have.property('projectId', 'test-project');
450
+ // expect(instance).to.have.property('endpoint', '/api/user-data');
451
+ // });
452
+
453
+ // it('write: calls authenticatedFetch and validates response', async function () {
454
+ // const item = { name: 'Atlas', hasDarkMode: false };
455
+ // atlasServiceMock.authenticatedFetch.resolves({
456
+ // ok: true,
457
+ // json: async () => await Promise.resolve(item),
458
+ // });
459
+ // const result = await instance.write('id1', item);
460
+ // expect(result).to.be.true;
461
+ // expect(atlasServiceMock.authenticatedFetch.calledOnce).to.be.true;
462
+ // });
463
+
464
+ // it('write: handles API error', async function () {
465
+ // atlasServiceMock.authenticatedFetch.resolves({ ok: false, status: 500 });
466
+ // const result = await instance.write('id1', { name: 'Atlas' });
467
+ // expect(result).to.be.false;
468
+ // });
469
+
470
+ // it('delete: calls authenticatedFetch and returns true on success', async function () {
471
+ // atlasServiceMock.authenticatedFetch.resolves({ ok: true });
472
+ // const result = await instance.delete('id1');
473
+ // expect(result).to.be.true;
474
+ // });
475
+
476
+ // it('delete: returns false on API failure', async function () {
477
+ // atlasServiceMock.authenticatedFetch.resolves({ ok: false });
478
+ // const result = await instance.delete('id1');
479
+ // expect(result).to.be.false;
480
+ // });
481
+
482
+ // it('readAll: returns validated items from API', async function () {
483
+ // const items = [
484
+ // { name: 'Atlas', hasDarkMode: true },
485
+ // { name: 'Compass', hasDarkMode: false },
486
+ // ];
487
+ // atlasServiceMock.authenticatedFetch.resolves({
488
+ // ok: true,
489
+ // json: async () => await Promise.resolve(items),
490
+ // });
491
+ // const result = await instance.readAll();
492
+ // expect(result.data).to.have.lengthOf(2);
493
+ // expect(result.errors).to.have.lengthOf(0);
494
+ // expect(result.data[0]).to.have.property('name');
495
+ // });
496
+
497
+ // it('readAll: returns errors for invalid items', async function () {
498
+ // const items = [
499
+ // { name: 'Atlas', hasDarkMode: 'not-a-bool' },
500
+ // { name: 'Compass', hasDarkMode: false },
501
+ // ];
502
+ // atlasServiceMock.authenticatedFetch.resolves({
503
+ // ok: true,
504
+ // json: async () => await Promise.resolve(items),
505
+ // });
506
+ // const result = await instance.readAll();
507
+ // expect(result.data).to.have.lengthOf(1);
508
+ // expect(result.errors).to.have.lengthOf(1);
509
+ // });
510
+
511
+ // it('updateAttributes: calls authenticatedFetch and validates response', async function () {
512
+ // const attrs = { hasDarkMode: false };
513
+ // atlasServiceMock.authenticatedFetch.resolves({
514
+ // ok: true,
515
+ // json: async () =>
516
+ // await Promise.resolve({ name: 'Atlas', hasDarkMode: false }),
517
+ // });
518
+ // const result = await instance.updateAttributes('id1', attrs);
519
+ // expect(result).to.deep.equal({ name: 'Atlas', hasDarkMode: false });
520
+ // });
521
+
522
+ // it('updateAttributes: returns undefined on API error', async function () {
523
+ // atlasServiceMock.authenticatedFetch.resolves({ ok: false });
524
+ // const result = await instance.updateAttributes('id1', {
525
+ // hasDarkMode: true,
526
+ // });
527
+ // expect(result).to.be.undefined;
528
+ // });
529
+ // });
0 commit comments