@@ -7,6 +7,7 @@ import {consoleLogger} from '@davidkhala/logger/log4.js';
7
7
import * as caCryptoGen from '../config/caCryptoGen.js' ;
8
8
import { importFrom } from '@davidkhala/light/es6.mjs' ;
9
9
import { ping } from '../common/nodejs/ca/ca.js' ;
10
+ import CertificateServiceWrapper from '../common/nodejs/ca/certificateService.js' ;
10
11
11
12
const logger = consoleLogger ( 'ca service' ) ;
12
13
const { TLS } = importFrom ( import . meta, '../config/orgs.json' ) ;
@@ -32,8 +33,6 @@ describe('caCryptoGen', () => {
32
33
} ) ;
33
34
34
35
describe ( 'ca service' , ( ) => {
35
- const org = 'icdd' ;
36
- const admin = helper . getOrgAdmin ( org ) ;
37
36
const protocol = `http${ TLS ? 's' : '' } ` ;
38
37
const hostname = 'localhost' ;
39
38
const port = 8054 ;
@@ -93,5 +92,31 @@ describe('identity service', function () {
93
92
assert . ifError ( await idService . getOne ( { enrollmentID : 'admin' } ) ) ;
94
93
95
94
} ) ;
95
+ it ( 'delete: on not exist' , async ( ) => {
96
+ assert . ifError ( await idService . delete ( { enrollmentID : 'admin' } ) ) ;
97
+ } ) ;
98
+ it ( 'delete: on exist' , async ( ) => {
99
+ const newUser = 'new' ;
100
+ await idService . createIfNotExist ( {
101
+ enrollmentID : newUser ,
102
+ affiliation : org ,
103
+ role : 'client'
104
+ } ) ;
105
+ const result = await idService . delete ( { enrollmentID : newUser } ) ;
106
+ logger . debug ( result ) ;
107
+ } ) ;
96
108
} ) ;
109
+ describe ( 'certificateService' , function ( ) {
110
+ const org = 'icdd' ;
111
+ const admin = helper . getOrgAdmin ( org ) ;
112
+ const protocol = `http${ TLS ? 's' : '' } ` ;
113
+ const hostname = 'localhost' ;
114
+ const port = 8054 ;
97
115
116
+ const caService = new CAService ( { protocol, hostname, port} ) ;
117
+ const certService = new CertificateServiceWrapper ( caService , admin , logger ) ;
118
+ it ( 'get all' , async ( ) => {
119
+ const results = await certService . getAll ( ) ;
120
+ logger . info ( results ) ;
121
+ } ) ;
122
+ } ) ;
0 commit comments