Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Commit

Permalink
Update Eventbrite lambda to use new utils module
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairjcbrown committed Nov 9, 2018
1 parent cf730b9 commit e89cb2d
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lambdas/eventbrite/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { convert } = require("./utils");
const { convert } = require("@muxer/lambda-utils");

const EVENTBRITE_TECH_CATEGORY = 102;

Expand Down
2 changes: 1 addition & 1 deletion lambdas/eventbrite/handlers/producer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use strict";

const { uploadTo } = require("@muxer/lambda-utils");
const { getFromWeb } = require("aws-lambda-data-utils");
const { buckets, getEventsUrl } = require("../config");
const { uploadTo } = require("../utils");

const getErrors = function(eventsPages) {
return eventsPages.reduce(function(errors, eventsPage) {
Expand Down
2 changes: 1 addition & 1 deletion lambdas/eventbrite/handlers/transformer.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use strict";

const eventSchema = require("@muxer/event-schema");
const { uploadTo } = require("@muxer/lambda-utils");
const { getFromS3 } = require("aws-lambda-data-utils");
const { validate } = require("jsonschema");
const { buckets } = require("../config");
const { uploadTo } = require("../utils");

const getLogoFrom = function({ logo }) {
if (!logo) return undefined;
Expand Down
8 changes: 8 additions & 0 deletions lambdas/eventbrite/package-lock.json

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

1 change: 1 addition & 0 deletions lambdas/eventbrite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"private": true,
"dependencies": {
"@muxer/event-schema": "^1.0.0",
"@muxer/lambda-utils": "^1.0.0",
"aws-lambda-data-utils": "^1.0.0",
"jsonschema": "^1.2.4"
}
Expand Down
26 changes: 0 additions & 26 deletions lambdas/eventbrite/utils.js

This file was deleted.

2 changes: 1 addition & 1 deletion lambdas/tests/eventbrite/handlers/producer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process.env.EVENTBRITE_API_TOKEN = "eventbrite-token-abc123";

const { prefix, resolved, resolvedResponse } = require("../test-utils");
const { getFromWeb } = require(`${prefix}/node_modules/aws-lambda-data-utils`);
const { uploadTo } = require(`${prefix}/utils`);
const { uploadTo } = require(`${prefix}/node_modules/@muxer/lambda-utils`);
const producer = require(`${prefix}/handlers/producer`);

const apiCallPage = page =>
Expand Down
2 changes: 1 addition & 1 deletion lambdas/tests/eventbrite/handlers/tranformer.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { prefix, resolved } = require("../test-utils");
const { getFromS3 } = require(`${prefix}/node_modules/aws-lambda-data-utils`);
const { uploadTo } = require(`${prefix}/utils`);
const { uploadTo } = require(`${prefix}/node_modules/@muxer/lambda-utils`);
const transformer = require(`${prefix}/handlers/transformer`);

const requireData = filename =>
Expand Down
11 changes: 7 additions & 4 deletions lambdas/tests/eventbrite/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ jest.mock("../../eventbrite/node_modules/aws-lambda-data-utils", () => ({
getFromS3: jest.fn()
}));

jest.mock("../../eventbrite/utils", () =>
Object.assign(require.requireActual("../../eventbrite/utils"), {
uploadTo: jest.fn()
})
jest.mock("../../eventbrite/node_modules/@muxer/lambda-utils", () =>
Object.assign(
require.requireActual("../../eventbrite/node_modules/@muxer/lambda-utils"),
{
uploadTo: jest.fn()
}
)
);

const prefix = "../../../eventbrite";
Expand Down

0 comments on commit e89cb2d

Please sign in to comment.