Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import AzureIndex from "./index";
import { MockFactory } from "./test/mockFactory"
import { AzureInvoke } from "./plugins/invoke/azureInvoke";
import { AzureLogs } from "./plugins/logs/azureLogs";
import { AzureRemove } from "./plugins/remove/azureRemove";
import { AzurePackage } from "./plugins/package/azurePackage";
import { AzureDeployPlugin } from "./plugins/deploy/azureDeployPlugin";
import { AzureLoginPlugin } from "./plugins/login/loginPlugin";
import { AzureApimServicePlugin } from "./plugins/apim/apimServicePlugin";
import { AzureApimFunctionPlugin } from "./plugins/apim/apimFunctionPlugin";
import AzureProvider from "./provider/azureProvider";

describe("Azure Index", () => {
it("contains all registered plugins", () => {
const sls = MockFactory.createTestServerless();
const options = MockFactory.createTestServerlessOptions();
const index = new AzureIndex(sls, options);
sls.setProvider = jest.fn();

expect(sls.setProvider).toBeCalledWith("azure", new AzureProvider(sls));

expect(sls.pluginManager.addPlugin).toBeCalledWith(AzurePackage);
expect(sls.pluginManager.addPlugin).toBeCalledWith(AzureInvoke);
expect(sls.pluginManager.addPlugin).toBeCalledWith(AzureLogs);
expect(sls.pluginManager.addPlugin).toBeCalledWith(AzureRemove);
expect(sls.pluginManager.addPlugin).toBeCalledWith(AzureLoginPlugin);
expect(sls.pluginManager.addPlugin).toBeCalledWith(AzureDeployPlugin);
expect(sls.pluginManager.addPlugin).toBeCalledWith(AzureApimServicePlugin);
expect(sls.pluginManager.addPlugin).toBeCalledWith(AzureApimFunctionPlugin);
});
});
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { AzureApimFunctionPlugin } from "./plugins/apim/apimFunctionPlugin";
import { AzureFuncPlugin } from "./plugins/func/azureFunc";


export class AzureIndex {
export default class AzureIndex {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does adding this default screw up any of the exports that serverless cares about? We initially saw some weirdness trying to use standard ES6 module export features with the root sls plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like as long as we have the module.exports at the end, it still works. Ran some deploys with this, and it seemed to work ok

public constructor(private serverless: Serverless, private options) {
this.serverless.setProvider(AzureProvider.getProviderName(), new AzureProvider(serverless) as any);

Expand Down