Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gilv93 committed Sep 18, 2024
1 parent 0ea625d commit d69de07
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 49 deletions.
2 changes: 1 addition & 1 deletion lib/recurly/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function token (customerData, bus, done) {
.then(results => {
enrichInputs(this, inputs, results)
})
.then(() => this.request.post({ route: '/tokens', data: inputs, done: complete }))
.then(() => this.request.post({ route: '/token', data: inputs, done: complete }))
.done();
}

Expand Down
1 change: 0 additions & 1 deletion lib/util/readiness-emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default class ReadinessEmitter extends Emitter {
* @return {[type]} [description]
*/
markReady () {
console.log('look we are ready')
this._ready = true;
this.emit('ready');
}
Expand Down
49 changes: 2 additions & 47 deletions test/unit/risk/three-d-secure.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('ThreeDSecure', function () {

beforeEach(function (done) {
const actionTokenId = this.actionTokenId = 'action-token-test';
const proactiveTokenId = this.proactiveTokenId = 'proactive-token-test';
const recurly = this.recurly = initRecurly();
const risk = this.risk = { add: sinon.stub(), remove: sinon.stub(),concerns: [], recurly };
const sandbox = this.sandbox = sinon.createSandbox();
Expand Down Expand Up @@ -180,17 +179,9 @@ describe('ThreeDSecure', function () {
new ThreeDSecure({ risk });
}, /Option actionTokenId must be a three_d_secure_action_token_id/);
});

it('does not throw an error if proactiveTokenId is provided instead', function () {
const { risk, proactiveTokenId } = this;

assert.doesNotThrow(() => {
new ThreeDSecure({ risk, proactiveTokenId });
});
});
});

describe.only('when an actionTokenId is valid', function () {
describe('when an actionTokenId is valid', function () {
it('sets the strategy according to the gateway type of the action token', function (done) {
const { risk } = this;
[
Expand Down Expand Up @@ -251,7 +242,7 @@ describe('ThreeDSecure', function () {
});
});

describe.only('when a proactiveTokenId is provided', function () {
describe('when a proactiveTokenId is provided', function () {
it('throws an error if it is not valid', function (done) {
const { risk } = this;
const threeDSecure = new ThreeDSecure({ risk, proactiveTokenId: 'invalid-token-id' });
Expand All @@ -263,42 +254,6 @@ describe('ThreeDSecure', function () {
});
});

it('sets the strategy to TestStrategy', function (done) {
const { risk, proactiveTokenId } = this;
const threeDSecure = new ThreeDSecure({ risk, proactiveTokenId });
threeDSecure.whenReady(() => {
assert(threeDSecure.strategy instanceof TestStrategy);
done();
});
});

it('constructs the strategy with the proactive token', function (done) {
const { risk, proactiveTokenId } = this;
const threeDSecure = new ThreeDSecure({ risk, proactiveTokenId });
threeDSecure.whenReady(() => {
const { strategy } = threeDSecure;
assert(strategy instanceof TestStrategy);
assert.strictEqual(strategy.proactiveToken.id, proactiveTokenId);
done();
});
});

it('reports the strategy name', function (done) {
const { risk, proactiveTokenId } = this;

const threeDSecure = new ThreeDSecure({ risk, proactiveTokenId });
risk.recurly.reporter.send.reset();

threeDSecure.whenReady(() => {
assert(risk.recurly.reporter.send.calledOnce);
assert(risk.recurly.reporter.send.calledWithMatch(
'three-d-secure:ready',
{ concernId: threeDSecure.id, strategy: 'test' }
));
done();
});
});

it('calls onStrategyDone when a strategy completes', function (done) {
const { sandbox, threeDSecure } = this;
const example = { arbitrary: 'test-payload' };
Expand Down

0 comments on commit d69de07

Please sign in to comment.