diff --git a/src/web-auth/transaction-manager.js b/src/web-auth/transaction-manager.js index 0a3b18b6..855ba712 100644 --- a/src/web-auth/transaction-manager.js +++ b/src/web-auth/transaction-manager.js @@ -54,7 +54,7 @@ TransactionManager.prototype.generateTransaction = function( state: state, lastUsedConnection: lastUsedConnection }, - times.MINUTES_30 + { expires: times.MINUTES_30 } ); return { state: state, diff --git a/test/web-auth/transaction-manager.test.js b/test/web-auth/transaction-manager.test.js index 9c6b632d..5f3834f9 100644 --- a/test/web-auth/transaction-manager.test.js +++ b/test/web-auth/transaction-manager.test.js @@ -4,6 +4,7 @@ import { stub, spy } from 'sinon'; import TransactionManager from '../../src/web-auth/transaction-manager'; import random from '../../src/helper/random'; import Storage from '../../src/helper/storage'; +import * as times from '../../src/helper/times'; context('TransactionManager', function() { beforeEach(function() { @@ -130,6 +131,12 @@ context('TransactionManager', function() { lastUsedConnection: 'lastUsedConnection' }); }); + it('stores state with expires option equal to 30 mins', function() { + this.tm.generateTransaction('appState', 'state', 'nonce', null); + expect(Storage.prototype.setItem.calledOnce).to.be(true); + expect(typeof Storage.prototype.setItem.lastCall.args[2]).to.be('object'); + expect(Storage.prototype.setItem.lastCall.args[2]).to.be.eql({ expires: times.MINUTES_30 }); + }); }); context('getStoredTransaction', function() { beforeEach(function() {