Skip to content

Commit

Permalink
Adding tests for Index type settings in TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
fishcharlie committed Aug 11, 2022
1 parent eceb4b9 commit 31e2bd7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/dynamoose/test/types/Schema.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down Expand Up @@ -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
}
}
});

0 comments on commit 31e2bd7

Please sign in to comment.