-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
77 additions
and
69 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
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
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
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
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
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 |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import Serverless from "serverless"; | ||
import ServerlessOpenapi3Plugin from "../src/index"; | ||
import { dummyServerless, dummyConfig, openApi } from "./testData"; | ||
import { service, options, openApi } from "./testData"; | ||
|
||
describe("ServerlessOpenapi3Plugin Test", () => { | ||
const plugin = new ServerlessOpenapi3Plugin(dummyServerless, dummyConfig); | ||
|
||
it("should replace OpenApi Object of RestApi Resource with resolved OpenApi Object", async () => { | ||
const serverless = new Serverless(); | ||
serverless.config.servicePath = __dirname; | ||
Object.assign((serverless.variables as any).service, service); | ||
|
||
const plugin = new ServerlessOpenapi3Plugin(serverless, options); | ||
|
||
const func = plugin.hooks["package:createDeploymentArtifacts"]; | ||
await func(); | ||
|
||
expect( | ||
dummyServerless.variables.service.resources.Resources.RestApi.Properties | ||
.Body | ||
(serverless.variables as any).service.resources.Resources.RestApi | ||
.Properties.Body | ||
).toEqual(openApi); | ||
}); | ||
}); |
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
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
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