File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
clients/client-s3/test/integ Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ import { S3 } from "@aws-sdk/client-s3" ;
2+ import { describe , expect , test as it } from "vitest" ;
3+
4+ import { requireRequestsFrom } from "../../../../private/aws-util-test/src" ;
5+
6+ describe ( "selectObjectContent" , ( ) => {
7+ const credentials = {
8+ accessKeyId : "INTEG" ,
9+ secretAccessKey : "INTEG" ,
10+ } ;
11+
12+ it ( "should make correct request" , async ( ) => {
13+ const client = new S3 ( { region : "us-west-2" , credentials } ) ;
14+
15+ requireRequestsFrom ( client ) . toMatch ( {
16+ hostname : / a w s - s d k - j s - i n t e g - t e s t - b u c k e t \. s 3 \. u s - w e s t - 2 \. a m a z o n a w s \. c o m / ,
17+ method : "POST" ,
18+ path : "/test-key" ,
19+ headers : {
20+ authorization : / A W S 4 - H M A C - S H A 2 5 6 C r e d e n t i a l / ,
21+ "content-type" : "application/xml" ,
22+ "x-amz-content-sha256" : / ./ ,
23+ } ,
24+ body ( xmlBody ) {
25+ expect ( xmlBody ) . toContain (
26+ "<Expression>SELECT user_name FROM S3Object WHERE cast(age as int) > 20</Expression>"
27+ ) ;
28+ expect ( xmlBody ) . toContain ( "<ExpressionType>SQL</ExpressionType>" ) ;
29+ } ,
30+ } ) ;
31+
32+ await client . selectObjectContent ( {
33+ Bucket : "aws-sdk-js-integ-test-bucket" ,
34+ Key : "test-key" ,
35+ ExpressionType : "SQL" ,
36+ Expression : "SELECT user_name FROM S3Object WHERE cast(age as int) > 20" ,
37+ InputSerialization : {
38+ CSV : {
39+ FileHeaderInfo : "USE" ,
40+ RecordDelimiter : "\n" ,
41+ FieldDelimiter : "," ,
42+ } ,
43+ } ,
44+ OutputSerialization : {
45+ CSV : { } ,
46+ } ,
47+ } ) ;
48+
49+ expect . hasAssertions ( ) ;
50+ } ) ;
51+ } ) ;
You can’t perform that action at this time.
0 commit comments