-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from voucherifyio/list-consents
Allow to list consents
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 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,11 @@ | ||
'use strict' | ||
|
||
module.exports = class Consents { | ||
constructor (client) { | ||
this.client = client | ||
} | ||
|
||
list (callback) { | ||
return this.client.get('/consents', null, callback) | ||
} | ||
} |
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,43 @@ | ||
/* eslint-env mocha */ | ||
/* eslint-disable no-unused-expressions */ | ||
|
||
const nock = require('nock') | ||
const { expect } = require('chai') | ||
const VoucherifyClient = require('./client-loader') | ||
const fixtures = require('./fixtures') | ||
const reqWithoutBody = fixtures.reqWithoutBody | ||
|
||
nock.disableNetConnect() | ||
|
||
describe('Consents API', function () { | ||
var client = new VoucherifyClient({ | ||
applicationId: 'node-sdk-test-id', | ||
clientSecretKey: 'node-sdk-test-secret' | ||
}) | ||
|
||
describe('list', function () { | ||
it('should list all consents', function (done) { | ||
var server = nock('https://api.voucherify.io', reqWithoutBody) | ||
.get('/v1/consents') | ||
.reply(200, []) | ||
|
||
client.consents.list() | ||
.then(function () { | ||
server.done() | ||
done() | ||
}) | ||
}) | ||
|
||
it('should list all consents (callback)', function (done) { | ||
var server = nock('https://api.voucherify.io', reqWithoutBody) | ||
.get('/v1/consents') | ||
.reply(200, []) | ||
|
||
client.consents.list(function (err) { | ||
expect(err).to.be.null | ||
server.done() | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) |