diff --git a/docs/generated/api.d.ts b/docs/generated/api.d.ts index 08980872..c8f188ab 100644 --- a/docs/generated/api.d.ts +++ b/docs/generated/api.d.ts @@ -5,25 +5,25 @@ import * as express from 'express'; /** * Register a function that handles CloudEvents. * @param functionName - the name of the function - * @param handler - the function to trigger when handling cloudevents + * @param handler - the function to trigger when handling CloudEvents * @public */ -export declare const cloudevent: (functionName: string, handler: CloudEventFunction) => void; +export declare const cloudEvent: (functionName: string, handler: CloudEventFunction) => void; /** - * A cloudevent function handler. + * A CloudEvent function handler. * @public */ export declare interface CloudEventFunction { - (cloudevent: CloudEventsContext): any; + (cloudEvent: CloudEventsContext): any; } /** - * A cloudevent function handler with callback. + * A CloudEvent function handler with callback. * @public */ export declare interface CloudEventFunctionWithCallback { - (cloudevent: CloudEventsContext, callback: Function): any; + (cloudEvent: CloudEventsContext, callback: Function): any; } /** diff --git a/docs/generated/api.json b/docs/generated/api.json index 1234cde8..e91daecc 100644 --- a/docs/generated/api.json +++ b/docs/generated/api.json @@ -171,12 +171,12 @@ "members": [ { "kind": "Variable", - "canonicalReference": "@google-cloud/functions-framework!cloudevent:var", - "docComment": "/**\n * Register a function that handles CloudEvents.\n *\n * @param functionName - the name of the function\n *\n * @param handler - the function to trigger when handling cloudevents\n *\n * @public\n */\n", + "canonicalReference": "@google-cloud/functions-framework!cloudEvent:var", + "docComment": "/**\n * Register a function that handles CloudEvents.\n *\n * @param functionName - the name of the function\n *\n * @param handler - the function to trigger when handling CloudEvents\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", - "text": "cloudevent: " + "text": "cloudEvent: " }, { "kind": "Content", @@ -193,7 +193,7 @@ } ], "releaseTag": "Public", - "name": "cloudevent", + "name": "cloudEvent", "variableTypeTokenRange": { "startIndex": 1, "endIndex": 4 @@ -202,7 +202,7 @@ { "kind": "Interface", "canonicalReference": "@google-cloud/functions-framework!CloudEventFunction:interface", - "docComment": "/**\n * A cloudevent function handler.\n *\n * @public\n */\n", + "docComment": "/**\n * A CloudEvent function handler.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", @@ -219,7 +219,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "(cloudevent: " + "text": "(cloudEvent: " }, { "kind": "Reference", @@ -247,7 +247,7 @@ "overloadIndex": 1, "parameters": [ { - "parameterName": "cloudevent", + "parameterName": "cloudEvent", "parameterTypeTokenRange": { "startIndex": 1, "endIndex": 2 @@ -261,7 +261,7 @@ { "kind": "Interface", "canonicalReference": "@google-cloud/functions-framework!CloudEventFunctionWithCallback:interface", - "docComment": "/**\n * A cloudevent function handler with callback.\n *\n * @public\n */\n", + "docComment": "/**\n * A CloudEvent function handler with callback.\n *\n * @public\n */\n", "excerptTokens": [ { "kind": "Content", @@ -278,7 +278,7 @@ "excerptTokens": [ { "kind": "Content", - "text": "(cloudevent: " + "text": "(cloudEvent: " }, { "kind": "Reference", @@ -315,7 +315,7 @@ "overloadIndex": 1, "parameters": [ { - "parameterName": "cloudevent", + "parameterName": "cloudEvent", "parameterTypeTokenRange": { "startIndex": 1, "endIndex": 2 diff --git a/docs/generated/api.md b/docs/generated/api.md index 5f499f18..e879a483 100644 --- a/docs/generated/api.md +++ b/docs/generated/api.md @@ -9,18 +9,18 @@ import * as express from 'express'; // @public -export const cloudevent: (functionName: string, handler: CloudEventFunction) => void; +export const cloudEvent: (functionName: string, handler: CloudEventFunction) => void; // @public export interface CloudEventFunction { // (undocumented) - (cloudevent: CloudEventsContext): any; + (cloudEvent: CloudEventsContext): any; } // @public export interface CloudEventFunctionWithCallback { // (undocumented) - (cloudevent: CloudEventsContext, callback: Function): any; + (cloudEvent: CloudEventsContext, callback: Function): any; } // @public diff --git a/experimental/generate_cloudevents/README.md b/experimental/generate_cloud_events/README.md similarity index 100% rename from experimental/generate_cloudevents/README.md rename to experimental/generate_cloud_events/README.md diff --git a/experimental/generate_cloudevents/package-lock.json b/experimental/generate_cloud_events/package-lock.json similarity index 100% rename from experimental/generate_cloudevents/package-lock.json rename to experimental/generate_cloud_events/package-lock.json diff --git a/experimental/generate_cloudevents/package.json b/experimental/generate_cloud_events/package.json similarity index 100% rename from experimental/generate_cloudevents/package.json rename to experimental/generate_cloud_events/package.json diff --git a/experimental/generate_cloudevents/src/generate.ts b/experimental/generate_cloud_events/src/generate.ts similarity index 100% rename from experimental/generate_cloudevents/src/generate.ts rename to experimental/generate_cloud_events/src/generate.ts diff --git a/experimental/generate_cloudevents/src/schema_types.ts b/experimental/generate_cloud_events/src/schema_types.ts similarity index 100% rename from experimental/generate_cloudevents/src/schema_types.ts rename to experimental/generate_cloud_events/src/schema_types.ts diff --git a/experimental/generate_cloudevents/src/utils.ts b/experimental/generate_cloud_events/src/utils.ts similarity index 100% rename from experimental/generate_cloudevents/src/utils.ts rename to experimental/generate_cloud_events/src/utils.ts diff --git a/experimental/generate_cloudevents/tsconfig.json b/experimental/generate_cloud_events/tsconfig.json similarity index 100% rename from experimental/generate_cloudevents/tsconfig.json rename to experimental/generate_cloud_events/tsconfig.json diff --git a/package.json b/package.json index 693eb407..7afde0a1 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "conformance": "./run_conformance_tests.sh", "check": "gts check", "clean": "gts clean", - "compile": "tsc -p .", + "compile": "rm -rf ./build && tsc -p .", "fix": "gts fix", "predocs": "npm run compile", "docs": "api-extractor run --local --verbose", diff --git a/src/cloudevent_types/CloudEvent.ts b/src/cloud_event_types/CloudEvent.ts similarity index 100% rename from src/cloudevent_types/CloudEvent.ts rename to src/cloud_event_types/CloudEvent.ts diff --git a/src/cloudevent_types/GoogleCloudEvent.ts b/src/cloud_event_types/GoogleCloudEvent.ts similarity index 100% rename from src/cloudevent_types/GoogleCloudEvent.ts rename to src/cloud_event_types/GoogleCloudEvent.ts diff --git a/src/cloudevent_types/cloud/audit/v1/LogEntryData.ts b/src/cloud_event_types/cloud/audit/v1/LogEntryData.ts similarity index 100% rename from src/cloudevent_types/cloud/audit/v1/LogEntryData.ts rename to src/cloud_event_types/cloud/audit/v1/LogEntryData.ts diff --git a/src/cloudevent_types/cloud/cloudbuild/v1/BuildEventData.ts b/src/cloud_event_types/cloud/cloudbuild/v1/BuildEventData.ts similarity index 100% rename from src/cloudevent_types/cloud/cloudbuild/v1/BuildEventData.ts rename to src/cloud_event_types/cloud/cloudbuild/v1/BuildEventData.ts diff --git a/src/cloudevent_types/cloud/firestore/v1/DocumentEventData.ts b/src/cloud_event_types/cloud/firestore/v1/DocumentEventData.ts similarity index 100% rename from src/cloudevent_types/cloud/firestore/v1/DocumentEventData.ts rename to src/cloud_event_types/cloud/firestore/v1/DocumentEventData.ts diff --git a/src/cloudevent_types/cloud/pubsub/v1/MessagePublishedData.ts b/src/cloud_event_types/cloud/pubsub/v1/MessagePublishedData.ts similarity index 100% rename from src/cloudevent_types/cloud/pubsub/v1/MessagePublishedData.ts rename to src/cloud_event_types/cloud/pubsub/v1/MessagePublishedData.ts diff --git a/src/cloudevent_types/cloud/scheduler/v1/SchedulerJobData.ts b/src/cloud_event_types/cloud/scheduler/v1/SchedulerJobData.ts similarity index 100% rename from src/cloudevent_types/cloud/scheduler/v1/SchedulerJobData.ts rename to src/cloud_event_types/cloud/scheduler/v1/SchedulerJobData.ts diff --git a/src/cloudevent_types/cloud/storage/v1/StorageObjectData.ts b/src/cloud_event_types/cloud/storage/v1/StorageObjectData.ts similarity index 100% rename from src/cloudevent_types/cloud/storage/v1/StorageObjectData.ts rename to src/cloud_event_types/cloud/storage/v1/StorageObjectData.ts diff --git a/src/cloudevent_types/firebase/analytics/v1/AnalyticsLogData.ts b/src/cloud_event_types/firebase/analytics/v1/AnalyticsLogData.ts similarity index 100% rename from src/cloudevent_types/firebase/analytics/v1/AnalyticsLogData.ts rename to src/cloud_event_types/firebase/analytics/v1/AnalyticsLogData.ts diff --git a/src/cloudevent_types/firebase/auth/v1/AuthEventData.ts b/src/cloud_event_types/firebase/auth/v1/AuthEventData.ts similarity index 100% rename from src/cloudevent_types/firebase/auth/v1/AuthEventData.ts rename to src/cloud_event_types/firebase/auth/v1/AuthEventData.ts diff --git a/src/cloudevent_types/firebase/database/v1/ReferenceEventData.ts b/src/cloud_event_types/firebase/database/v1/ReferenceEventData.ts similarity index 100% rename from src/cloudevent_types/firebase/database/v1/ReferenceEventData.ts rename to src/cloud_event_types/firebase/database/v1/ReferenceEventData.ts diff --git a/src/cloudevent_types/firebase/remoteconfig/v1/RemoteConfigEventData.ts b/src/cloud_event_types/firebase/remoteconfig/v1/RemoteConfigEventData.ts similarity index 100% rename from src/cloudevent_types/firebase/remoteconfig/v1/RemoteConfigEventData.ts rename to src/cloud_event_types/firebase/remoteconfig/v1/RemoteConfigEventData.ts diff --git a/src/cloudevent_types/firebase/testlab/v1/TestMatrixEventData.ts b/src/cloud_event_types/firebase/testlab/v1/TestMatrixEventData.ts similarity index 100% rename from src/cloudevent_types/firebase/testlab/v1/TestMatrixEventData.ts rename to src/cloud_event_types/firebase/testlab/v1/TestMatrixEventData.ts diff --git a/src/cloudevents.ts b/src/cloud_events.ts similarity index 100% rename from src/cloudevents.ts rename to src/cloud_events.ts diff --git a/src/function_registry.ts b/src/function_registry.ts index c8cd56ab..b3b3e348 100644 --- a/src/function_registry.ts +++ b/src/function_registry.ts @@ -64,10 +64,10 @@ export const http = (functionName: string, handler: HttpFunction): void => { /** * Register a function that handles CloudEvents. * @param functionName - the name of the function - * @param handler - the function to trigger when handling cloudevents + * @param handler - the function to trigger when handling CloudEvents * @public */ -export const cloudevent = ( +export const cloudEvent = ( functionName: string, handler: CloudEventFunction ): void => { diff --git a/src/function_wrappers.ts b/src/function_wrappers.ts index 5d0428b2..13ddc986 100644 --- a/src/function_wrappers.ts +++ b/src/function_wrappers.ts @@ -17,7 +17,7 @@ import * as domain from 'domain'; import {Request, Response, RequestHandler} from 'express'; import {sendCrashResponse} from './logger'; import {sendResponse} from './invoker'; -import {isBinaryCloudEvent, getBinaryCloudEventContext} from './cloudevents'; +import {isBinaryCloudEvent, getBinaryCloudEventContext} from './cloud_events'; import { HttpFunction, EventFunction, @@ -56,17 +56,17 @@ const getOnDoneCallback = (res: Response): OnDoneCallback => { }; /** - * Helper function to parse a cloudevent object from an HTTP request. + * Helper function to parse a CloudEvent object from an HTTP request. * @param req an Express HTTP request - * @returns a cloudevent parsed from the request + * @returns a CloudEvent parsed from the request */ const parseCloudEventRequest = (req: Request): CloudEventsContext => { - let cloudevent = req.body; + let cloudEvent = req.body; if (isBinaryCloudEvent(req)) { - cloudevent = getBinaryCloudEventContext(req); - cloudevent.data = req.body; + cloudEvent = getBinaryCloudEventContext(req); + cloudEvent.data = req.body; } - return cloudevent; + return cloudEvent; }; /** @@ -119,7 +119,7 @@ const wrapHttpFunction = (execute: HttpFunction): RequestHandler => { }; /** - * Wraps an async cloudevent function in an express RequestHandler. + * Wraps an async CloudEvent function in an express RequestHandler. * @param userFunction User's function. * @return An Express hander function that invokes the user function. */ @@ -128,9 +128,9 @@ const wrapCloudEventFunction = ( ): RequestHandler => { const httpHandler = (req: Request, res: Response) => { const callback = getOnDoneCallback(res); - const cloudevent = parseCloudEventRequest(req); + const cloudEvent = parseCloudEventRequest(req); Promise.resolve() - .then(() => userFunction(cloudevent)) + .then(() => userFunction(cloudEvent)) .then( result => callback(null, result), err => callback(err, undefined) @@ -140,7 +140,7 @@ const wrapCloudEventFunction = ( }; /** - * Wraps callback style cloudevent function in an express RequestHandler. + * Wraps callback style CloudEvent function in an express RequestHandler. * @param userFunction User's function. * @return An Express hander function that invokes the user function. */ @@ -149,8 +149,8 @@ const wrapCloudEventFunctionWithCallback = ( ): RequestHandler => { const httpHandler = (req: Request, res: Response) => { const callback = getOnDoneCallback(res); - const cloudevent = parseCloudEventRequest(req); - return userFunction(cloudevent, callback); + const cloudEvent = parseCloudEventRequest(req); + return userFunction(cloudEvent, callback); }; return wrapHttpFunction(httpHandler); }; diff --git a/src/functions.ts b/src/functions.ts index f39cd50d..c696e63c 100644 --- a/src/functions.ts +++ b/src/functions.ts @@ -55,18 +55,18 @@ export interface EventFunctionWithCallback { (data: {}, context: Context, callback: Function): any; } /** - * A cloudevent function handler. + * A CloudEvent function handler. * @public */ export interface CloudEventFunction { - (cloudevent: CloudEventsContext): any; + (cloudEvent: CloudEventsContext): any; } /** - * A cloudevent function handler with callback. + * A CloudEvent function handler with callback. * @public */ export interface CloudEventFunctionWithCallback { - (cloudevent: CloudEventsContext, callback: Function): any; + (cloudEvent: CloudEventsContext, callback: Function): any; } /** * A function handler. diff --git a/src/index.ts b/src/index.ts index f85b9141..9c804b63 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,4 +20,4 @@ export * from './functions'; /** * @public */ -export {http, cloudevent} from './function_registry'; +export {http, cloudEvent} from './function_registry'; diff --git a/src/middleware/background_event_to_cloudevent.ts b/src/middleware/background_event_to_cloud_event.ts similarity index 96% rename from src/middleware/background_event_to_cloudevent.ts rename to src/middleware/background_event_to_cloud_event.ts index f82a539e..e23b8531 100644 --- a/src/middleware/background_event_to_cloudevent.ts +++ b/src/middleware/background_event_to_cloud_event.ts @@ -16,8 +16,8 @@ import { CE_SERVICE, EventConversionError, isBinaryCloudEvent, -} from '../cloudevents'; -import {CE_TO_BACKGROUND_TYPE} from './cloudevent_to_background_event'; +} from '../cloud_events'; +import {CE_TO_BACKGROUND_TYPE} from './cloud_event_to_background_event'; import {CloudFunctionsContext, LegacyEvent} from '../functions'; // Maps GCF Event types to the equivalent CloudEventType @@ -193,7 +193,7 @@ export const backgroundEventToCloudEventMiddleware = ( if (service === CE_SERVICE.FIREBASE_AUTH) { if ('metadata' in data) { - // Some metadata are not consistent between cloudevents and background events + // Some metadata are not consistent between CloudEvents and background events const metadata: object = data.metadata; data.metadata = {}; // eslint-disable-next-line prefer-const @@ -213,7 +213,7 @@ export const backgroundEventToCloudEventMiddleware = ( const domain = req.body['domain']; if (!domain) { throw new EventConversionError( - `Unable convert to ${CE_SERVICE.FIREBASE_DB} cloudevent: invalid domain` + `Unable convert to ${CE_SERVICE.FIREBASE_DB} CloudEvent: invalid domain` ); } let location = 'us-central1'; @@ -221,7 +221,7 @@ export const backgroundEventToCloudEventMiddleware = ( const match = domain.match(/^([\w-]+)\.firebasedatabase\.app$/); if (!match) { throw new EventConversionError( - `Unable convert to ${CE_SERVICE.FIREBASE_DB} cloudevent: invalid domain` + `Unable convert to ${CE_SERVICE.FIREBASE_DB} CloudEvent: invalid domain` ); } location = match[1]; diff --git a/src/middleware/cloudevent_to_background_event.ts b/src/middleware/cloud_event_to_background_event.ts similarity index 97% rename from src/middleware/cloudevent_to_background_event.ts rename to src/middleware/cloud_event_to_background_event.ts index b303e7b4..80c7f8ab 100644 --- a/src/middleware/cloudevent_to_background_event.ts +++ b/src/middleware/cloud_event_to_background_event.ts @@ -17,7 +17,7 @@ import { isBinaryCloudEvent, getBinaryCloudEventContext, EventConversionError, -} from '../cloudevents'; +} from '../cloud_events'; // Maps CloudEvent types to the equivalent GCF Event type export const CE_TO_BACKGROUND_TYPE: {[k: string]: string} = { @@ -132,7 +132,7 @@ const marshalConvertableCloudEvent = ( // FirebaseAuth resource format resource = name; if ('metadata' in data) { - // Some metadata are not consistent between cloudevents and legacy events + // Some metadata are not consistent between CloudEvents and legacy events const metadata: object = data.metadata; data.metadata = {}; // eslint-disable-next-line prefer-const @@ -177,7 +177,7 @@ const marshalConvertableCloudEvent = ( * @param res express response object * @param next function used to pass control to the next middle middleware function in the stack */ -export const cloudeventToBackgroundEventMiddleware = ( +export const cloudEventToBackgroundEventMiddleware = ( req: Request, res: Response, next: NextFunction diff --git a/src/pubsub_middleware.ts b/src/pubsub_middleware.ts index f3a9482a..f8f04f45 100644 --- a/src/pubsub_middleware.ts +++ b/src/pubsub_middleware.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. import {Request, Response, NextFunction} from 'express'; -import {isBinaryCloudEvent} from './cloudevents'; +import {isBinaryCloudEvent} from './cloud_events'; const PUBSUB_EVENT_TYPE = 'google.pubsub.topic.publish'; const PUBSUB_MESSAGE_TYPE = diff --git a/src/server.ts b/src/server.ts index 67da78ef..a4faa250 100644 --- a/src/server.ts +++ b/src/server.ts @@ -20,8 +20,8 @@ import {HandlerFunction, Request, Response} from './functions'; import {SignatureType} from './types'; import {setLatestRes} from './invoker'; import {legacyPubSubEventMiddleware} from './pubsub_middleware'; -import {cloudeventToBackgroundEventMiddleware} from './middleware/cloudevent_to_background_event'; -import {backgroundEventToCloudEventMiddleware} from './middleware/background_event_to_cloudevent'; +import {cloudEventToBackgroundEventMiddleware} from './middleware/cloud_event_to_background_event'; +import {backgroundEventToCloudEventMiddleware} from './middleware/background_event_to_cloud_event'; import {wrapUserFunction} from './function_wrappers'; /** @@ -108,7 +108,7 @@ export function getServer( } if (functionSignatureType === 'event') { - app.use(cloudeventToBackgroundEventMiddleware); + app.use(cloudEventToBackgroundEventMiddleware); } if (functionSignatureType === 'cloudevent') { app.use(backgroundEventToCloudEventMiddleware); diff --git a/test/conformance/function.js b/test/conformance/function.js index c3cd5b60..3b77c646 100644 --- a/test/conformance/function.js +++ b/test/conformance/function.js @@ -8,9 +8,9 @@ functions.http('writeHttpDeclarative', (req, res) => { res.end(200); }); -functions.cloudevent('writeCloudEventDeclarative', cloudevent => { - cloudevent.datacontenttype = 'application/json'; - writeJson(cloudevent); +functions.cloudEvent('writeCloudEventDeclarative', cloudEvent => { + cloudEvent.datacontenttype = 'application/json'; + writeJson(cloudEvent); }); function writeHttp(req, res) { @@ -18,9 +18,9 @@ function writeHttp(req, res) { res.end(200); } -function writeCloudEvent(cloudevent) { - cloudevent.datacontenttype = 'application/json'; - writeJson(cloudevent); +function writeCloudEvent(cloudEvent) { + cloudEvent.datacontenttype = 'application/json'; + writeJson(cloudEvent); } function writeLegacyEvent(data, context) { diff --git a/test/function_registry.ts b/test/function_registry.ts index 6ff40960..d9d9641b 100644 --- a/test/function_registry.ts +++ b/test/function_registry.ts @@ -25,8 +25,8 @@ describe('function_registry', () => { assert.deepStrictEqual((userFunction as () => string)(), 'HTTP_PASS'); }); - it('can register cloudevent functions', () => { - FunctionRegistry.cloudevent('ceFunction', () => 'CE_PASS'); + it('can register CloudEvent functions', () => { + FunctionRegistry.cloudEvent('ceFunction', () => 'CE_PASS'); const { userFunction, signatureType, diff --git a/test/function_wrappers.ts b/test/function_wrappers.ts index 61d391f4..ca43eeba 100644 --- a/test/function_wrappers.ts +++ b/test/function_wrappers.ts @@ -74,11 +74,11 @@ describe('wrapUserFunction', () => { func(request, response, () => {}); }); - it('correctly wraps an async cloudevent function', done => { + it('correctly wraps an async CloudEvent function', done => { const request = createRequest(CLOUD_EVENT); const response = createResponse(); - const func = wrapUserFunction(async (cloudevent: CloudEventsContext) => { - assert.deepStrictEqual(cloudevent, CLOUD_EVENT); + const func = wrapUserFunction(async (cloudEvent: CloudEventsContext) => { + assert.deepStrictEqual(cloudEvent, CLOUD_EVENT); // await to make sure wrapper handles async code await new Promise(resolve => setTimeout(resolve, 20)); done(); @@ -86,14 +86,14 @@ describe('wrapUserFunction', () => { func(request, response, () => {}); }); - it('correctly wraps a cloudevent function with callback', done => { + it('correctly wraps a CloudEvent function with callback', done => { const request = createRequest(CLOUD_EVENT); const response = createResponse(); const func = wrapUserFunction( - (cloudevent: CloudEventsContext, callback: Function) => { + (cloudEvent: CloudEventsContext, callback: Function) => { // timeout to make sure wrapper waits for callback setTimeout(() => { - assert.deepStrictEqual(cloudevent, CLOUD_EVENT); + assert.deepStrictEqual(cloudEvent, CLOUD_EVENT); callback(); done(); }, 20); diff --git a/test/integration/cloudevent.ts b/test/integration/cloudevent.ts index 273318ae..0e1946fe 100644 --- a/test/integration/cloudevent.ts +++ b/test/integration/cloudevent.ts @@ -234,8 +234,8 @@ describe('CloudEvent Function', () => { testData.forEach(test => { it(`${test.name}`, async () => { let receivedCloudEvent: functions.CloudEventsContext | null = null; - const server = getServer((cloudevent: functions.CloudEventsContext) => { - receivedCloudEvent = cloudevent as functions.CloudEventsContext; + const server = getServer((cloudEvent: functions.CloudEventsContext) => { + receivedCloudEvent = cloudEvent as functions.CloudEventsContext; }, 'cloudevent'); await supertest(server) .post('/') diff --git a/test/loader.ts b/test/loader.ts index 0c68bd93..96c6de4e 100644 --- a/test/loader.ts +++ b/test/loader.ts @@ -121,7 +121,7 @@ describe('loading function', () => { }); it('respects the registered signature type', async () => { - FunctionRegistry.cloudevent('registeredFunction', () => {}); + FunctionRegistry.cloudEvent('registeredFunction', () => {}); const loadedFunction = await loader.getUserFunction( process.cwd() + '/test/data/with_main', 'registeredFunction', diff --git a/test/middleware/background_event_to_cloudevent.ts b/test/middleware/background_event_to_cloud_event.ts similarity index 98% rename from test/middleware/background_event_to_cloudevent.ts rename to test/middleware/background_event_to_cloud_event.ts index ffd6df8c..4192411d 100644 --- a/test/middleware/background_event_to_cloudevent.ts +++ b/test/middleware/background_event_to_cloud_event.ts @@ -5,9 +5,9 @@ import {Response, Request} from 'express'; import { splitResource, backgroundEventToCloudEventMiddleware, -} from '../../src/middleware/background_event_to_cloudevent'; +} from '../../src/middleware/background_event_to_cloud_event'; import {CloudFunctionsContext} from '../../src/functions'; -import {EventConversionError} from '../../src/cloudevents'; +import {EventConversionError} from '../../src/cloud_events'; describe('splitResource', () => { const testData = [ diff --git a/test/middleware/cloudevent_to_background_event.ts b/test/middleware/cloud_event_to_background_event.ts similarity index 95% rename from test/middleware/cloudevent_to_background_event.ts rename to test/middleware/cloud_event_to_background_event.ts index 509e18d1..687f238c 100644 --- a/test/middleware/cloudevent_to_background_event.ts +++ b/test/middleware/cloud_event_to_background_event.ts @@ -3,10 +3,10 @@ import * as sinon from 'sinon'; import {Response, Request} from 'express'; import { - cloudeventToBackgroundEventMiddleware, + cloudEventToBackgroundEventMiddleware, parseSource, -} from '../../src/middleware/cloudevent_to_background_event'; -import {EventConversionError} from '../../src/cloudevents'; +} from '../../src/middleware/cloud_event_to_background_event'; +import {EventConversionError} from '../../src/cloud_events'; const ceHeaders = (eventType: string, source: string) => ({ 'ce-id': 'my-id', @@ -54,7 +54,7 @@ describe('parseSource', () => { }); }); -describe('cloudeventToBackgroundEventMiddleware', () => { +describe('cloudEventToBackgroundEventMiddleware', () => { const testData = [ { name: 'Non-CE-Request is not altered', @@ -174,7 +174,7 @@ describe('cloudeventToBackgroundEventMiddleware', () => { headers: test.headers as object, header: (key: string) => (test.headers as {[key: string]: string})[key], }; - cloudeventToBackgroundEventMiddleware( + cloudEventToBackgroundEventMiddleware( request as Request, {} as Response, next diff --git a/test/system-test/pack_n_play.ts b/test/system-test/pack_n_play.ts index 83273b81..96fd46b1 100644 --- a/test/system-test/pack_n_play.ts +++ b/test/system-test/pack_n_play.ts @@ -7,8 +7,8 @@ describe('📦 pack-n-play test', () => { const options = { packageDir: process.cwd(), sample: { - description: 'JavaScript user can use the cloudevents file', - js: readFileSync('./build/src/cloudevents.js').toString(), + description: 'JavaScript user can use the cloud_events file', + js: readFileSync('./build/src/cloud_events.js').toString(), }, }; await packNTest(options);