From 31e2bd79aa62ba016fbc4db9faf87cddfa7c33ca Mon Sep 17 00:00:00 2001 From: Charlie Fish Date: Wed, 10 Aug 2022 18:33:44 -0600 Subject: [PATCH] Adding tests for Index type settings in TypeScript --- packages/dynamoose/test/types/Schema.ts | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/dynamoose/test/types/Schema.ts b/packages/dynamoose/test/types/Schema.ts index d11f1f108..0bfa223c0 100644 --- a/packages/dynamoose/test/types/Schema.ts +++ b/packages/dynamoose/test/types/Schema.ts @@ -1,6 +1,7 @@ /* eslint @typescript-eslint/no-unused-vars: 0 */ import * as dynamoose from "../../dist"; +import {IndexType} from "../../dist/Schema"; // @ts-expect-error const shouldFailWithNothingPassedIn = new dynamoose.Schema(); @@ -115,3 +116,36 @@ const shouldSucceedWithAsyncValidateMethodSchema = new dynamoose.Schema({ "validate": (value) => Promise.resolve(true) } }); + +const shouldSucceedWithIndexTypeValueAsGlobalString = new dynamoose.Schema({ + "id": { + "type": String, + "index": { + "type": "global" + } + } +}); +const shouldSucceedWithIndexTypeValueAsLocalString = new dynamoose.Schema({ + "id": { + "type": String, + "index": { + "type": "local" + } + } +}); +const shouldSucceedWithIndexTypeValueAsGlobalEnumValue = new dynamoose.Schema({ + "id": { + "type": String, + "index": { + "type": IndexType.global + } + } +}); +const shouldSucceedWithIndexTypeValueAsLocalEnumValue = new dynamoose.Schema({ + "id": { + "type": String, + "index": { + "type": IndexType.local + } + } +});