@@ -43,6 +43,17 @@ describe('codec', function() {
4343 } ) ;
4444
4545 describe ( 'SpannerDate' , function ( ) {
46+ it ( 'should choke on multiple arguments' , function ( ) {
47+ var expectedErrorMessage = [
48+ 'The spanner.date function accepts a Date object or a' ,
49+ 'single argument parseable by Date\'s constructor.'
50+ ] . join ( ' ' ) ;
51+
52+ assert . throws ( function ( ) {
53+ new codec . SpannerDate ( 2012 , 3 , 21 ) ;
54+ } , new RegExp ( expectedErrorMessage ) ) ;
55+ } ) ;
56+
4657 it ( 'should create an instance from a string' , function ( ) {
4758 var spannerDate = new codec . SpannerDate ( '08-20-1969' ) ;
4859 assert . strictEqual ( spannerDate . value , '1969-08-20' ) ;
@@ -53,12 +64,6 @@ describe('codec', function() {
5364 var spannerDate = new codec . SpannerDate ( date ) ;
5465 assert . strictEqual ( spannerDate . value , date . toJSON ( ) . replace ( / T .+ / , '' ) ) ;
5566 } ) ;
56-
57- it ( 'should choke on multiple arguments' , function ( ) {
58- assert . throws ( function ( ) {
59- new codec . SpannerDate ( 2012 , 3 , 21 ) ;
60- } , / T h e s p a n n e r \. d a t e f u n c t i o n a c c e p t s a D a t e o b j e c t , / ) ;
61- } ) ;
6267 } ) ;
6368
6469 describe ( 'Float' , function ( ) {
0 commit comments