SIGN IN SIGN UP

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.

0 0 17 Java
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { describe, it, expect, vi } from "vitest";
import { makeValidatePythonScriptStep } from "../scenarios/basic/steps/validate-python-script.js";
describe("validate-python-script", () => {
it("should throw an error if the script is not found", () => {
const s3ListObjects = vi.fn(() =>
Promise.resolve({
Contents: [{ Key: "WrongKey" }],
}),
);
const actions = { s3ListObjects };
const step = makeValidatePythonScriptStep(actions);
return expect(step({})).rejects.toEqual(
new Error(
"Missing ETL python script. Did you run the setup steps in the readme?",
),
);
});
it("should return a context object", async () => {
process.env.PYTHON_SCRIPT_KEY = "scriptName";
const s3ListObjects = vi.fn(() =>
Promise.resolve({
Contents: [{ Key: "scriptName" }],
}),
);
const actions = { s3ListObjects };
const step = makeValidatePythonScriptStep(actions);
const actual = await step({});
expect(actual).toEqual({});
});
});