aws-testing-library
Advanced tools
Comparing version 2.1.3 to 2.1.4
import { IDynamoDbProps } from '../common/dynamoDb'; | ||
export declare const toHaveItem: (this: jest.MatcherUtils, props: IDynamoDbProps, key: AWS.DynamoDB.DocumentClient.Key, expected?: import("aws-sdk/clients/dynamodb").DocumentClient.AttributeMap | undefined, strict?: boolean) => Promise<{ | ||
export declare const toHaveItem: (this: jest.MatcherUtils, props: IDynamoDbProps, key: AWS.DynamoDB.DocumentClient.Key, expected?: AWS.DynamoDB.DocumentClient.AttributeMap, strict?: boolean) => Promise<{ | ||
message: () => string; | ||
pass: boolean; | ||
}>; |
/// <reference types="node" /> | ||
import { IS3Props } from '../common/s3'; | ||
export declare const toHaveObject: (this: jest.MatcherUtils, props: IS3Props, key: string, expected?: Buffer | undefined) => Promise<{ | ||
export declare const toHaveObject: (this: jest.MatcherUtils, props: IS3Props, key: string, expected?: Buffer) => Promise<{ | ||
message: () => string; | ||
pass: boolean; | ||
}>; |
import { Method } from 'axios'; | ||
export declare type PlainObject = Record<string, string>; | ||
export declare const getResponse: (url: string, method: Method, params?: PlainObject | undefined, data?: PlainObject | undefined, headers?: PlainObject | undefined) => Promise<{ | ||
export declare const getResponse: (url: string, method: Method, params?: PlainObject, data?: PlainObject, headers?: PlainObject) => Promise<{ | ||
statusCode: number; | ||
data: any; | ||
}>; |
@@ -5,2 +5,7 @@ "use strict"; | ||
const AWS = require("aws-sdk"); | ||
function* chunks(arr, n) { | ||
for (let i = 0; i < arr.length; i += n) { | ||
yield arr.slice(i, i + n); | ||
} | ||
} | ||
const itemToKey = (item, keySchema) => { | ||
@@ -30,8 +35,10 @@ let itemKey = {}; | ||
if (items.length > 0) { | ||
const deleteRequests = items.map((item) => ({ | ||
DeleteRequest: { Key: itemToKey(item, keySchema) }, | ||
})); | ||
await db | ||
.batchWrite({ RequestItems: { [tableName]: deleteRequests } }) | ||
.promise(); | ||
for (const chunk of chunks(items, 25)) { | ||
const deleteRequests = chunk.map((item) => ({ | ||
DeleteRequest: { Key: itemToKey(item, keySchema) }, | ||
})); | ||
await db | ||
.batchWrite({ RequestItems: { [tableName]: deleteRequests } }) | ||
.promise(); | ||
} | ||
} | ||
@@ -38,0 +45,0 @@ }; |
/// <reference types="node" /> | ||
export declare const clearAllObjects: (region: string, bucket: string, prefix?: string | undefined) => Promise<void>; | ||
export declare const clearAllObjects: (region: string, bucket: string, prefix?: string) => Promise<void>; | ||
export declare const getObject: (region: string, bucket: string, key: string) => Promise<{ | ||
@@ -4,0 +4,0 @@ body: Buffer; |
{ | ||
"name": "aws-testing-library", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Chai and Jest matchers for aws services", | ||
@@ -44,6 +44,6 @@ "scripts": { | ||
"devDependencies": { | ||
"@commitlint/cli": "^16.0.0", | ||
"@commitlint/config-conventional": "^16.0.0", | ||
"@commitlint/cli": "^17.0.0", | ||
"@commitlint/config-conventional": "^17.0.0", | ||
"@types/chai": "^4.2.12", | ||
"@types/jest": "^27.0.0", | ||
"@types/jest": "^28.0.0", | ||
"@types/jest-diff": "^24.3.0", | ||
@@ -60,3 +60,3 @@ "@types/jest-matcher-utils": "^25.1.0", | ||
"eslint-config-prettier": "^8.0.0", | ||
"husky": "^7.0.0", | ||
"husky": "^8.0.0", | ||
"jest": "^28.0.0", | ||
@@ -63,0 +63,0 @@ "mockdate": "^3.0.0", |
Sorry, the diff of this file is not supported yet
105455
1418