Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('AffiliationService: Test getAll() function', function (t) {
let client = new FabricCAClient({protocol: 'http', hostname: '127.0.0.1', port: 7054});
let affiliation = new AffiliationService(client);
t.throws(()=> {
affiliation.getAll();
},
/Missing required argument "registrar"/,
'Must fail if missing registrar argument');
t.throws(()=> {
affiliation.getAll({});
},
/Argument "registrar" must be an instance of the class "User", but is found to be missing a method "getSigningIdentity/,
'Must fail if registrar argument is not a User object');
t.throws(()=> {
affiliation.getAll({getSigningIdentity: function() {return;}});
},
test('AffiliationService: Test delete() function', function (t) {
let client = new FabricCAClient({protocol: 'http', hostname: '127.0.0.1', port: 7054});
let affiliation = new AffiliationService(client);
t.throws(()=> {
affiliation.delete();
},
/Missing required argument "req"/,
'Must fail if missing request argument');
t.throws(()=> {
affiliation.delete({name: null});
},
/Missing required argument "req.name", or argument "req.name" is not a valid string/,
'Must fail if missing or invalid req.name argument');
t.throws(()=> {
affiliation.delete({name: 'name'});
},
test('AffiliationService: Test create() function', function (t) {
let client = new FabricCAClient({protocol: 'http', hostname: '127.0.0.1', port: 7054});
let affiliation = new AffiliationService(client);
t.throws(()=> {
affiliation.create();
},
/Missing required argument "req"/,
'Must fail if missing request argument');
t.throws(()=> {
affiliation.create({name: null});
},
/Missing required parameters. "req.name" is required./,
'Must fail if missing req.name argument');
t.throws(()=> {
affiliation.create({name: 'name'});
},
test('AffiliationService: Test getOne() function', function (t) {
let client = new FabricCAClient({protocol: 'http', hostname: '127.0.0.1', port: 7054});
let affiliation = new AffiliationService(client);
t.throws(()=> {
affiliation.getOne();
},
/Missing required argument "affiliation", or argument "affiliation" is not a valid string/,
'Must fail if missing affiliation argument');
t.throws(()=> {
affiliation.getOne('affiliation');
},
/Missing required argument "registrar"/,
'Must fail if missing registrar argument');
t.throws(()=> {
affiliation.getOne('affiliation', {});
},
test('AffiliationService: Test update() function', function (t) {
let client = new FabricCAClient({protocol: 'http', hostname: '127.0.0.1', port: 7054});
let affiliation = new AffiliationService(client);
t.throws(()=> {
affiliation.update();
},
/Missing required argument "affiliation", or argument "affiliation" is not a valid string/,
'Must fail if missing affiliation argument');
t.throws(()=> {
affiliation.update('affiliation');
},
/Missing required argument "req"/,
'Must fail if missing request argument');
t.throws(()=> {
affiliation.update('affiliation', {name: null});
},