-
Notifications
You must be signed in to change notification settings - Fork 955
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added tests, removed console.debug statements Signed-off-by: nfrunza <nfrunza@gmail.com>
- Loading branch information
Showing
5 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"from": "Sun Dec 08 2019 22:22:00 GMT-0500 (Eastern Standard Time)", | ||
"to": "Mon Dec 09 2019 22:22:00 GMT-0500 (Eastern Standard Time)", | ||
"orgs": ["OrdererMSP", "Org2MSP"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"from": "Sun Dec 08 2019 22:22:00 GMT-0500 (Eastern Standard Time)", | ||
"to": "Mon Dec 09 2019 22:22:00 GMT-0500 (Eastern Standard Time)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"from": "Sun Dec 08 2019 22:22:00 GMT-0500 (Eastern Standard Time)", | ||
"to": "Mon Dec 09 2019 22:22:00 GMT-0500 (Eastern Standard Time)", | ||
"orgs": "OrgOne" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
const expect = require('chai').expect; | ||
const assert = require('assert'); | ||
const chai = require('chai'); | ||
const chaiHttp = require('chai-http'); | ||
const helper = require('../common/helper'); | ||
const reqMultiOrgs = require('./fixtures/reqMultiOrgs.json'); | ||
const reqOneOrg = require('./fixtures/reqOneOrg.json'); | ||
const reqNoOrgs = require('./fixtures/reqNoOrgs.json'); | ||
|
||
const should = chai.should(); | ||
chai.use(chaiHttp); | ||
const requestutils = require('../rest/requestutils.js'); | ||
|
||
describe('requestutils().orgsArrayToString should return empty string', () => { | ||
const emptyString = requestutils.orgsArrayToString(reqNoOrgs); | ||
it('requestutils().orgsArrayToString should return empty string', () => { | ||
assert.equal('', emptyString); | ||
}); | ||
}); | ||
|
||
describe('requestutils().orgsArrayToString should return single quotes value', () => { | ||
const oneOrgString = requestutils.orgsArrayToString(reqOneOrg); | ||
it('requestutils().orgsArrayToString should return single quotes value', () => { | ||
assert.equal("'OrgOne'", oneOrgString); | ||
}); | ||
}); | ||
|
||
describe('requestutils().orgsArrayToString should return comma separated single quotes values ', () => { | ||
const multiOrgsString = requestutils.orgsArrayToString(reqMultiOrgs); | ||
const multiOrgs = "'OrdererMSP','Org2MSP'"; | ||
it('requestutils().orgsArrayToString should return comma separated single quotes values ', () => { | ||
assert.equal(multiOrgs, multiOrgsString); | ||
}); | ||
}); |