@@ -80,6 +80,24 @@ describe('TransactionRequest', function() {
8080 } ) ;
8181
8282 describe ( 'instantiation' , function ( ) {
83+ var formatTimestamp ;
84+
85+ before ( function ( ) {
86+ formatTimestamp = TransactionRequest . formatTimestampOptions_ ;
87+ } ) ;
88+
89+ beforeEach ( function ( ) {
90+ TransactionRequest . formatTimestampOptions_ = function ( ) { } ;
91+ } ) ;
92+
93+ after ( function ( ) {
94+ TransactionRequest . formatTimestampOptions_ = formatTimestamp ;
95+ } ) ;
96+
97+ it ( 'should default readOnly to false' , function ( ) {
98+ assert . strictEqual ( transactionRequest . readOnly , false ) ;
99+ } ) ;
100+
83101 it ( 'should localize the transaction options' , function ( ) {
84102 var UNFORMATTED_OPTIONS = {
85103 b : 'b'
@@ -89,10 +107,9 @@ describe('TransactionRequest', function() {
89107 a : 'a'
90108 } ;
91109
92- var formatTimestamp = TransactionRequest . formatTimestampOptions_ ;
93-
94110 TransactionRequest . formatTimestampOptions_ = function ( options ) {
95- assert . strictEqual ( options , UNFORMATTED_OPTIONS ) ;
111+ assert . deepEqual ( options , UNFORMATTED_OPTIONS ) ;
112+ assert . notStrictEqual ( options , UNFORMATTED_OPTIONS ) ;
96113 return FORMATTED_OPTIONS ;
97114 } ;
98115
@@ -115,6 +132,18 @@ describe('TransactionRequest', function() {
115132 TransactionRequest . formatTimestampOptions_ = formatTimestamp ;
116133 } ) ;
117134
135+ it ( 'should capture the readOnly option' , function ( ) {
136+ TransactionRequest . formatTimestampOptions_ = function ( options ) {
137+ assert . strictEqual ( options . readOnly , undefined ) ;
138+ } ;
139+
140+ var transaction = new TransactionRequest ( {
141+ readOnly : true
142+ } ) ;
143+
144+ assert . strictEqual ( transaction . readOnly , true ) ;
145+ } ) ;
146+
118147 it ( 'should promisify all the things' , function ( ) {
119148 assert ( promisified ) ;
120149 } ) ;
0 commit comments