@@ -27,7 +27,7 @@ describe('Entry', function() {
2727 var Entry ;
2828 var entry ;
2929
30- var RESOURCE = { } ;
30+ var METADATA = { } ;
3131 var DATA = { } ;
3232
3333 before ( function ( ) {
@@ -40,23 +40,18 @@ describe('Entry', function() {
4040
4141 beforeEach ( function ( ) {
4242 extend ( FakeGrpcService , GrpcService ) ;
43- entry = new Entry ( RESOURCE , DATA ) ;
43+ entry = new Entry ( METADATA , DATA ) ;
4444 } ) ;
4545
4646 describe ( 'instantiation' , function ( ) {
47- it ( 'should treat resource as data if data is not provided' , function ( ) {
48- var entry = new Entry ( DATA ) ;
49- assert . strictEqual ( entry . data , DATA ) ;
50- assert . strictEqual ( entry . resource , undefined ) ;
51- } ) ;
52-
53- it ( 'should localize resource and data' , function ( ) {
54- assert . strictEqual ( entry . resource , RESOURCE ) ;
47+ it ( 'should localize metadata and data' , function ( ) {
48+ assert . strictEqual ( entry . metadata , METADATA ) ;
5549 assert . strictEqual ( entry . data , DATA ) ;
5650 } ) ;
5751 } ) ;
5852
5953 describe ( 'fromApiResponse_' , function ( ) {
54+ var RESOURCE = { } ;
6055 var entry ;
6156 var date = new Date ( ) ;
6257
@@ -82,10 +77,10 @@ describe('Entry', function() {
8277
8378 it ( 'should create an Entry' , function ( ) {
8479 assert ( entry instanceof Entry ) ;
85- assert . strictEqual ( entry . resource , RESOURCE ) ;
80+ assert . strictEqual ( entry . metadata . resource , RESOURCE ) ;
8681 assert . strictEqual ( entry . data , DATA ) ;
87- assert . strictEqual ( entry . extraProperty , true ) ;
88- assert . deepEqual ( entry . timestamp , date ) ;
82+ assert . strictEqual ( entry . metadata . extraProperty , true ) ;
83+ assert . deepEqual ( entry . metadata . timestamp , date ) ;
8984 } ) ;
9085
9186 it ( 'should extend the entry with proto data' , function ( ) {
@@ -123,52 +118,6 @@ describe('Entry', function() {
123118 assert . deepEqual ( entryBefore , entryAfter ) ;
124119 } ) ;
125120
126- it ( 'should only include correct properties' , function ( ) {
127- var propertiesToInclude = [
128- 'logName' ,
129- 'resource' ,
130- 'timestamp' ,
131- 'severity' ,
132- 'insertId' ,
133- 'httpRequest' ,
134- 'labels' ,
135- 'operation'
136- ] ;
137-
138- var value = 'value' ;
139-
140- propertiesToInclude . forEach ( function ( property ) {
141- entry [ property ] = value ;
142- } ) ;
143-
144- entry . extraProperty = true ;
145-
146- var json = entry . toJSON ( ) ;
147-
148- assert ( propertiesToInclude . every ( function ( property ) {
149- if ( property === 'resource' ) {
150- return json [ property ] . type === value ;
151- }
152-
153- return json [ property ] === value ;
154- } ) ) ;
155-
156- // Was removed for JSON representation...
157- assert . strictEqual ( json . extraProperty , undefined ) ;
158- // ...but still exists on the Entry.
159- assert . strictEqual ( entry . extraProperty , true ) ;
160- } ) ;
161-
162- it ( 'should convert a string resource to an object' , function ( ) {
163- entry . resource = 'resource-name' ;
164-
165- var json = entry . toJSON ( ) ;
166-
167- assert . deepEqual ( json . resource , {
168- type : entry . resource
169- } ) ;
170- } ) ;
171-
172121 it ( 'should convert data as a struct and assign to jsonPayload' , function ( ) {
173122 var input = { } ;
174123 var converted = { } ;
@@ -203,7 +152,7 @@ describe('Entry', function() {
203152
204153 it ( 'should convert a date' , function ( ) {
205154 var date = new Date ( ) ;
206- entry . timestamp = date ;
155+ entry . metadata . timestamp = date ;
207156
208157 var json = entry . toJSON ( ) ;
209158
0 commit comments