lib: expose constants in a more intuitive way (#299)
* Constants can now be accessed more easily from the top level import/require users can now do `const { CONSTANTS } = require('cloudevents')` fixes #298 Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>
This commit is contained in:
parent
bc81242c7c
commit
a7e0aa07ac
|
@ -8,6 +8,8 @@ import { Receiver, Mode } from "./transport/receiver";
|
||||||
import { Protocol } from "./transport/protocols";
|
import { Protocol } from "./transport/protocols";
|
||||||
import { Headers, headersFor } from "./transport/http/headers";
|
import { Headers, headersFor } from "./transport/http/headers";
|
||||||
|
|
||||||
|
import CONSTANTS from "./constants";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
// From event
|
// From event
|
||||||
CloudEvent,
|
CloudEvent,
|
||||||
|
@ -25,4 +27,6 @@ export {
|
||||||
TransportOptions,
|
TransportOptions,
|
||||||
Headers,
|
Headers,
|
||||||
headersFor,
|
headersFor,
|
||||||
|
// From Constants
|
||||||
|
CONSTANTS,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import CONSTANTS from "../../src/constants";
|
import { CONSTANTS } from "../../src";
|
||||||
|
|
||||||
describe("Constants exposed by top level exports", () => {
|
describe("Constants exposed by top level exports", () => {
|
||||||
it("Exports an ENCODING_BASE64 constant", () => {
|
it("Exports an ENCODING_BASE64 constant", () => {
|
||||||
|
|
Loading…
Reference in New Issue