File tree Expand file tree Collapse file tree 3 files changed +40
-3
lines changed
clients/client-lex-runtime-service Expand file tree Collapse file tree 3 files changed +40
-3
lines changed Original file line number Diff line number Diff line change
1
+ /// <reference types="mocha" />
2
+ import { expect } from "chai" ;
3
+ import { LexRuntimeService } from "./LexRuntimeService" ;
4
+ import { SerializeMiddleware } from "@aws-sdk/types" ;
5
+ import { HttpRequest } from "@aws-sdk/protocol-http" ;
6
+
7
+ describe ( "@aws-sdk/client-lex-runtime-service" , ( ) => {
8
+ describe ( "PostContent" , ( ) => {
9
+ it ( "should contain correct x-amz-content-sha256 header" , async ( ) => {
10
+ const validator : SerializeMiddleware < any , any > = next => args => {
11
+ // middleware intercept the request and return it early
12
+ const request = args . request as HttpRequest ;
13
+ expect ( request . headers ) . to . have . property (
14
+ "x-amz-content-sha256" ,
15
+ "UNSIGNED-PAYLOAD"
16
+ ) ;
17
+ return Promise . resolve ( { output : { } as any , response : { } as any } ) ;
18
+ } ;
19
+ const client = new LexRuntimeService ( { } ) ;
20
+ client . middlewareStack . add ( validator , {
21
+ step : "serialize" ,
22
+ name : "endpointValidator" ,
23
+ priority : "low"
24
+ } ) ;
25
+ return await client . postContent ( {
26
+ botAlias : "alias" ,
27
+ botName : "bot" ,
28
+ userId : "user" ,
29
+ contentType : "text/plain; charset=utf-8" ,
30
+ inputStream : "hello world!"
31
+ } ) ;
32
+ } ) ;
33
+ } ) ;
34
+ } ) ;
Original file line number Diff line number Diff line change 12
12
"remove-documentation" : " rimraf ./docs" ,
13
13
"remove-js" : " rimraf *.js && rimraf ./commands/*.js && rimraf ./models/*.js && rimraf ./protocols/*.js" ,
14
14
"remove-maps" : " rimraf *.js.map && rimraf ./commands/*.js.map && rimraf ./models/*.js.map && rimraf ./protocols/*.js.map" ,
15
- "test" : " exit 0" ,
15
+ "test:unit" : " mocha **/cjs/**/*.spec.js" ,
16
+ "test" : " yarn test:unit" ,
16
17
"build:es" : " tsc -p tsconfig.es.json" ,
17
18
"build" : " yarn pretest && yarn build:es"
18
19
},
60
61
"tslib" : " ^1.8.0"
61
62
},
62
63
"devDependencies" : {
64
+ "@types/chai" : " ^4.2.11" ,
65
+ "@types/mocha" : " ^7.0.2" ,
63
66
"@types/node" : " ^12.7.5" ,
64
- "jest" : " ^25.1.0" ,
65
67
"rimraf" : " ^3.0.0" ,
66
68
"tslib" : " ^1.8.0" ,
67
69
"typedoc" : " ^0.15.0" ,
Original file line number Diff line number Diff line change 12
12
"incremental" : true ,
13
13
"resolveJsonModule" : true ,
14
14
"declarationDir" : " ./types" ,
15
- "outDir" : " dist/cjs"
15
+ "outDir" : " dist/cjs" ,
16
+ "types" : [" mocha" , " node" ]
16
17
},
17
18
"typedocOptions" : {
18
19
"exclude" : " **/node_modules/**" ,
You can’t perform that action at this time.
0 commit comments