import * as React from "react";
import DataLayer, { reducePropsToState, createDataLayerScript } from "../containers/dataLayer";
import { shallow } from "enzyme";
describe("", () => {
it("should be a component", () => {
const wrapper = shallow();
const data = DataLayer.peek();
expect(data).toEqual({
cd1: "custom dimension"
});
});
it("should combine all calls into one object", () => {
const state = reducePropsToState([{
data: {
cd1: "foo"
},
}, {
data: {
cd2: "bar",
}
}])
expect(state).toHaveProperty("cd1");
expect(state).toHaveProperty("cd2");
});
it("should create an initial data layer script", () => {
const script = createDataLayerScript({
cd1: "foo",
cd2: "bar",
});
expect(script).toMatchSnapshot();
});
});