can you please see below code and tell me what is wrong with it? The code times out after 5 seconds, but I would expect it to run just fine, as per official description.
Does anyone see what is fundamentally wrong?
import * as AWS from "aws-sdk-mock";
import * as _AWS from "aws-sdk";
beforeAll(async (done) => {
//get requires env vars
});
describe("the module", () => {
it("should read from the database", async () => {
AWS.mock('DynamoDB.DocumentClient', 'get', (error, callback) => { callback(null, "got it")});
expect(await (new _AWS.DynamoDB.DocumentClient()).get({TableName:"", Key: {pk: "foo", sk: "bar"}}).promise()).toBe("got it");
});
});
afterAll(() => {
AWS.restore();
});
i finally found the working variant: