forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand-helper.unit.test.ts
More file actions
25 lines (24 loc) · 1.08 KB
/
command-helper.unit.test.ts
File metadata and controls
25 lines (24 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { describe, it, expect } from "vitest";
import { buildStatementCommand } from "../src/statement-commands/command-helper.js";
describe("command-helper", () => {
describe("buildStatementCommand", () => {
it("should create an ExecuteStatementCommand with the provided SQL statement", () => {
const sql = "select * from some_table";
const command = buildStatementCommand(sql);
expect(command.constructor.name).toBe("ExecuteStatementCommand");
expect(command.input.sql).toBe(sql);
});
});
it("should create an ExecuteStatementCommand with the provided SQL statement and parameters", () => {
const sql = "select * from some_table where id = :id";
const parameters = {
id: { StringValue: "123" },
};
const command = buildStatementCommand(sql, parameters);
expect(command.constructor.name).toBe("ExecuteStatementCommand");
expect(command.input.sql).toBe(sql);
expect(command.input.parameters).toEqual([parameters]);
});
});