@@ -70,70 +70,49 @@ describe('Document', function() {
7070 assert . strictEqual ( document . api , LANGUAGE . api ) ;
7171 } ) ;
7272
73- it ( 'should set the correct reqOpts for inline content' , function ( ) {
74- assert . deepEqual ( document . reqOpts , {
75- document : {
76- content : CONFIG ,
77- type : 'PLAIN_TEXT'
78- }
73+ it ( 'should set the correct document for inline content' , function ( ) {
74+ assert . deepEqual ( document . document , {
75+ content : CONFIG ,
76+ type : 'PLAIN_TEXT'
7977 } ) ;
8078 } ) ;
8179
82- it ( 'should set the correct reqOpts for content with encoding ' , function ( ) {
80+ it ( 'should set and uppercase the correct encodingType ' , function ( ) {
8381 var document = new Document ( LANGUAGE , {
8482 content : CONFIG ,
8583 encoding : 'utf-8'
8684 } ) ;
8785
88- assert . deepEqual ( document . reqOpts , {
89- document : {
90- content : CONFIG ,
91- type : 'PLAIN_TEXT'
92- } ,
93- encodingType : 'UTF8'
94- } ) ;
86+ assert . strictEqual ( document . encodingType , 'UTF8' ) ;
9587 } ) ;
9688
97- it ( 'should set the correct reqOpts for content with language' , function ( ) {
89+ it ( 'should set the correct document for content with language' , function ( ) {
9890 var document = new Document ( LANGUAGE , {
9991 content : CONFIG ,
10092 language : 'EN'
10193 } ) ;
10294
103- assert . deepEqual ( document . reqOpts , {
104- document : {
105- content : CONFIG ,
106- type : 'PLAIN_TEXT' ,
107- language : 'EN'
108- }
109- } ) ;
95+ assert . strictEqual ( document . document . language , 'EN' ) ;
11096 } ) ;
11197
112- it ( 'should set the correct reqOpts for content with type' , function ( ) {
98+ it ( 'should set the correct document for content with type' , function ( ) {
11399 var document = new Document ( LANGUAGE , {
114100 content : CONFIG ,
115101 type : 'html'
116102 } ) ;
117103
118- assert . deepEqual ( document . reqOpts , {
119- document : {
120- content : CONFIG ,
121- type : 'HTML'
122- }
123- } ) ;
104+ assert . strictEqual ( document . document . type , 'HTML' ) ;
124105 } ) ;
125106
126- it ( 'should set the correct reqOpts for text' , function ( ) {
107+ it ( 'should set the correct document for text' , function ( ) {
127108 var document = new Document ( LANGUAGE , {
128109 content : CONFIG ,
129110 type : 'text'
130111 } ) ;
131112
132- assert . deepEqual ( document . reqOpts , {
133- document : {
134- content : CONFIG ,
135- type : 'PLAIN_TEXT'
136- }
113+ assert . deepEqual ( document . document , {
114+ content : CONFIG ,
115+ type : 'PLAIN_TEXT'
137116 } ) ;
138117 } ) ;
139118
@@ -156,17 +135,12 @@ describe('Document', function() {
156135 content : file
157136 } ) ;
158137
159- assert . deepEqual ( document . reqOpts , {
160- document : {
161- gcsContentUri : [
162- 'gs://' ,
163- encodeURIComponent ( file . bucket . id ) ,
164- '/' ,
165- encodeURIComponent ( file . id ) ,
166- ] . join ( '' ) ,
167- type : 'PLAIN_TEXT'
168- }
169- } ) ;
138+ assert . deepEqual ( document . document . gcsContentUri , [
139+ 'gs://' ,
140+ encodeURIComponent ( file . bucket . id ) ,
141+ '/' ,
142+ encodeURIComponent ( file . id ) ,
143+ ] . join ( '' ) ) ;
170144 } ) ;
171145 } ) ;
172146
@@ -197,21 +171,21 @@ describe('Document', function() {
197171 it ( 'should make the correct API request' , function ( done ) {
198172 document . api . Language = {
199173 annotateText : function ( doc , features , encType ) {
200- assert . strictEqual ( doc , document . reqOpts . document ) ;
174+ assert . strictEqual ( doc , document . document ) ;
201175
202176 assert . deepEqual ( features , {
203177 extractDocumentSentiment : true ,
204178 extractEntities : true ,
205179 extractSyntax : true
206180 } ) ;
207181
208- assert . strictEqual ( encType , document . reqOpts . encodingType ) ;
182+ assert . strictEqual ( encType , document . encodingType ) ;
209183
210184 done ( ) ;
211185 }
212186 } ;
213187
214- document . reqOpts . encodingType = 'encoding-type' ;
188+ document . encodingType = 'encoding-type' ;
215189 document . annotate ( assert . ifError ) ;
216190 } ) ;
217191
@@ -453,13 +427,13 @@ describe('Document', function() {
453427 it ( 'should make the correct API request' , function ( done ) {
454428 document . api . Language = {
455429 analyzeEntities : function ( doc , encType ) {
456- assert . strictEqual ( doc , document . reqOpts . document ) ;
457- assert . strictEqual ( encType , document . reqOpts . encodingType ) ;
430+ assert . strictEqual ( doc , document . document ) ;
431+ assert . strictEqual ( encType , document . encodingType ) ;
458432 done ( ) ;
459433 }
460434 } ;
461435
462- document . reqOpts . encodingType = 'encoding-type' ;
436+ document . encodingType = 'encoding-type' ;
463437 document . detectEntities ( assert . ifError ) ;
464438 } ) ;
465439
@@ -542,13 +516,13 @@ describe('Document', function() {
542516 it ( 'should make the correct API request' , function ( done ) {
543517 document . api . Language = {
544518 analyzeSentiment : function ( doc , encType ) {
545- assert . strictEqual ( doc , document . reqOpts . document ) ;
546- assert . strictEqual ( encType , document . reqOpts . encodingType ) ;
519+ assert . strictEqual ( doc , document . document ) ;
520+ assert . strictEqual ( encType , document . encodingType ) ;
547521 done ( ) ;
548522 }
549523 } ;
550524
551- document . reqOpts . encodingType = 'encoding-type' ;
525+ document . encodingType = 'encoding-type' ;
552526 document . detectSentiment ( assert . ifError ) ;
553527 } ) ;
554528
0 commit comments