From 1863171edc4498622df623fa99e8cc8c156df4b6 Mon Sep 17 00:00:00 2001 From: Elliot Blackburn Date: Wed, 13 Dec 2017 11:58:13 +0000 Subject: [PATCH] Add mock-aws-s3 typings --- types/mock-aws-s3/index.d.ts | 15 +++++++++++++++ types/mock-aws-s3/mock-aws-s3-tests.ts | 16 ++++++++++++++++ types/mock-aws-s3/package.json | 6 ++++++ types/mock-aws-s3/tsconfig.json | 16 ++++++++++++++++ types/mock-aws-s3/tslint.json | 3 +++ 5 files changed, 56 insertions(+) create mode 100644 types/mock-aws-s3/index.d.ts create mode 100644 types/mock-aws-s3/mock-aws-s3-tests.ts create mode 100644 types/mock-aws-s3/package.json create mode 100644 types/mock-aws-s3/tsconfig.json create mode 100644 types/mock-aws-s3/tslint.json diff --git a/types/mock-aws-s3/index.d.ts b/types/mock-aws-s3/index.d.ts new file mode 100644 index 0000000000..754629f5a2 --- /dev/null +++ b/types/mock-aws-s3/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for mock-aws-s3 2.6 +// Project: https://github.com/MathieuLoutre/mock-aws-s3 +// Definitions by: Elliot Blackburn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mock-aws-s3 +// TypeScript Version: 2.2 + +// This is a mocking library, types should reflect that of the actual library. +export * from "aws-sdk"; +import { GlobalConfigInstance } from "aws-sdk/lib/config"; + +export interface MockConfigInstance extends GlobalConfigInstance { + basePath: string; +} + +export let config: MockConfigInstance; diff --git a/types/mock-aws-s3/mock-aws-s3-tests.ts b/types/mock-aws-s3/mock-aws-s3-tests.ts new file mode 100644 index 0000000000..b517729968 --- /dev/null +++ b/types/mock-aws-s3/mock-aws-s3-tests.ts @@ -0,0 +1,16 @@ +import * as MockAWS from "mock-aws-s3"; + +const s3 = new MockAWS.S3({ + params: { Bucket: "example" } +}); + +s3.putObject( + { + Bucket: "example", + Key: "sea/animal.json", + Body: '{"is dog":false,"name":"otter","stringified object?":true}' + }, + (err: MockAWS.AWSError, data: MockAWS.S3.Types.PutObjectOutput) => { + s3.listObjects({ Bucket: 'example', Prefix: "sea" }, (err: any, data: any) => {}); + } +); diff --git a/types/mock-aws-s3/package.json b/types/mock-aws-s3/package.json new file mode 100644 index 0000000000..6298c6d4c8 --- /dev/null +++ b/types/mock-aws-s3/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "aws-sdk": ">=2.169.0" + } +} diff --git a/types/mock-aws-s3/tsconfig.json b/types/mock-aws-s3/tsconfig.json new file mode 100644 index 0000000000..9b5aeeacaa --- /dev/null +++ b/types/mock-aws-s3/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "mock-aws-s3-tests.ts"] +} diff --git a/types/mock-aws-s3/tslint.json b/types/mock-aws-s3/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/mock-aws-s3/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}