@@ -48,6 +48,23 @@ describe('entity', function() {
4848 } ) ;
4949 } ) ;
5050
51+ describe ( 'isDsDouble' , function ( ) {
52+ it ( 'should correctly identify a Double' , function ( ) {
53+ var double = new entity . Double ( 0.42 ) ;
54+ assert . strictEqual ( entity . isDsDouble ( double ) , true ) ;
55+ } ) ;
56+
57+ it ( 'should correctly identify a homomorphic non-Double' , function ( ) {
58+ var nonDouble = Object . assign ( { } , new entity . Double ( 42 ) ) ;
59+ assert . strictEqual ( entity . isDsDouble ( nonDouble ) , false ) ;
60+ } ) ;
61+
62+ it ( 'should correctly identify a primitive' , function ( ) {
63+ var primitiveDouble = 0.42 ;
64+ assert . strictEqual ( entity . isDsDouble ( primitiveDouble ) , false ) ;
65+ } ) ;
66+ } ) ;
67+
5168 describe ( 'Int' , function ( ) {
5269 it ( 'should store the stringified value' , function ( ) {
5370 var value = 8 ;
@@ -57,6 +74,23 @@ describe('entity', function() {
5774 } ) ;
5875 } ) ;
5976
77+ describe ( 'isDsInt' , function ( ) {
78+ it ( 'should correctly identify an Int' , function ( ) {
79+ var int = new entity . Int ( 42 ) ;
80+ assert . strictEqual ( entity . isDsInt ( int ) , true ) ;
81+ } ) ;
82+
83+ it ( 'should correctly identify homomorphic non-Int' , function ( ) {
84+ var nonInt = Object . assign ( { } , new entity . Int ( 42 ) ) ;
85+ assert . strictEqual ( entity . isDsInt ( nonInt ) , false ) ;
86+ } ) ;
87+
88+ it ( 'should correctly identify a primitive' , function ( ) {
89+ var primitiveInt = 42 ;
90+ assert . strictEqual ( entity . isDsInt ( primitiveInt ) , false ) ;
91+ } ) ;
92+ } ) ;
93+
6094 describe ( 'GeoPoint' , function ( ) {
6195 it ( 'should store the value' , function ( ) {
6296 var value = {
@@ -69,6 +103,19 @@ describe('entity', function() {
69103 } ) ;
70104 } ) ;
71105
106+ describe ( 'isDsGeoPoint' , function ( ) {
107+ it ( 'should correctly identify a GeoPoint' , function ( ) {
108+ var geoPoint = new entity . GeoPoint ( { latitude : 24 , longitude : 88 } ) ;
109+ assert . strictEqual ( entity . isDsGeoPoint ( geoPoint ) , true ) ;
110+ } ) ;
111+
112+ it ( 'should correctly identify a homomorphic non-GeoPoint' , function ( ) {
113+ var geoPoint = new entity . GeoPoint ( { latitude : 24 , longitude : 88 } ) ;
114+ var nonGeoPoint = Object . assign ( { } , geoPoint ) ;
115+ assert . strictEqual ( entity . isDsGeoPoint ( nonGeoPoint ) , false ) ;
116+ } ) ;
117+ } ) ;
118+
72119 describe ( 'Key' , function ( ) {
73120 it ( 'should assign the namespace' , function ( ) {
74121 var namespace = 'NS' ;
@@ -116,6 +163,18 @@ describe('entity', function() {
116163 } ) ;
117164 } ) ;
118165
166+ describe ( 'isDsKey' , function ( ) {
167+ it ( 'should correctly identify a Key' , function ( ) {
168+ var key = new entity . Key ( { path : [ 'Kind' , 1 ] } ) ;
169+ assert . strictEqual ( entity . isDsKey ( key ) , true ) ;
170+ } ) ;
171+
172+ it ( 'should correctly identify a homomorphic non-Key' , function ( ) {
173+ var notKey = Object . assign ( { } , new entity . Key ( { path : [ 'Kind' , 1 ] } ) ) ;
174+ assert . strictEqual ( entity . isDsKey ( notKey ) , false ) ;
175+ } ) ;
176+ } ) ;
177+
119178 describe ( 'decodeValueProto' , function ( ) {
120179 it ( 'should decode arrays' , function ( ) {
121180 var expectedValue = [ { } ] ;
0 commit comments