-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
307 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@smithy/smithy-client": minor | ||
--- | ||
|
||
add Command classBuilder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Command } from "./command"; | ||
|
||
describe(Command.name, () => { | ||
it("implements a classBuilder", async () => { | ||
class MyCommand extends Command.classBuilder<any, any, any, any, any>() | ||
.ep({ | ||
Endpoint: { type: "builtInParams", name: "Endpoint" }, | ||
}) | ||
.m(function () { | ||
return []; | ||
}) | ||
.s("SmithyMyClient", "SmithyMyOperation", {}) | ||
.n("MyClient", "MyCommand") | ||
.f() | ||
.ser(async (_) => _) | ||
.de(async (_) => _) | ||
.build() {} | ||
|
||
const myCommand = new MyCommand({ | ||
Prop: "prop1", | ||
}); | ||
|
||
expect(myCommand).toBeInstanceOf(Command); | ||
expect(myCommand).toBeInstanceOf(MyCommand); | ||
expect(MyCommand.getEndpointParameterInstructions()).toEqual({ | ||
Endpoint: { type: "builtInParams", name: "Endpoint" }, | ||
}); | ||
expect(myCommand.input).toEqual({ | ||
Prop: "prop1", | ||
}); | ||
|
||
// private method exists for compatibility | ||
expect((myCommand as any).serialize).toBeDefined(); | ||
|
||
// private method exists for compatibility | ||
expect((myCommand as any).deserialize).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters