Skip to content

Commit

Permalink
feat: Fetch bindings.json from official Azure Functions repo (#364)
Browse files Browse the repository at this point in the history
Simple GET request to fetch the JSON object from the master branch of the GitHub repo.
  • Loading branch information
tbarlow12 committed Oct 25, 2019
1 parent a1d45f0 commit 4e30115
Show file tree
Hide file tree
Showing 9 changed files with 1,635 additions and 932 deletions.
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const configConstants = {
prefix: "sls",
localPort: 7071,
},
bindingsJsonUrl: "https://raw.githubusercontent.com/Azure/azure-functions-templates/master/Functions.Templates/Bindings/bindings.json"
};

export default configConstants;
6 changes: 4 additions & 2 deletions src/services/offlineService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ describe("Offline Service", () => {
expect(calls).toHaveLength(functionNames.length + 1);
for (let i = 0; i < functionNames.length; i++) {
const name = functionNames[i];
expect(calls[i][0]).toEqual(`${name}${path.sep}function.json`)
const call = calls.find((c) => c[0] === `${name}${path.sep}function.json`);
expect(call).toBeTruthy();

expect(
JSON.parse(calls[i][1])
JSON.parse(call[1])
).toEqual(
MockFactory.createTestBindingsObject(`..${path.sep}${name}.js`)
);
Expand Down
4 changes: 2 additions & 2 deletions src/services/packageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class PackageService extends BaseService {
*/
public async createBindings(): Promise<void> {
const createEventsPromises = this.serverless.service.getAllFunctions()
.map((functionName) => {
const metaData = Utils.getFunctionMetaData(functionName, this.serverless);
.map(async (functionName) => {
const metaData = await Utils.getFunctionMetaData(functionName, this.serverless);
return this.createBinding(functionName, metaData);
});

Expand Down
Loading

0 comments on commit 4e30115

Please sign in to comment.