"use strict";

var _url = require("../url");

var _state = require("../state");

describe("initialiseFormState", function () {
  test("initialiseFormState(defaultValues, encodedValues) => { formState, fullState }", function () {
    var defaultValues = {
      layout: "table",
      groupBy: "name",
      hidePassing: true,
      labels: {
        "canary:DBAdmin:true": 0,
        "canary:high:true": 0
      }
    };
    var incomingValues = {
      hidePassing: false,
      labels: {
        "canary:high:true": -1
      },
      foo: "bar"
    };
    var encodedValues = (0, _url.encodeObjectToUrlSearchParams)(incomingValues);

    var _initialiseFormState = (0, _state.initialiseFormState)(defaultValues, encodedValues),
        formState = _initialiseFormState.formState,
        fullState = _initialiseFormState.fullState;

    expect(fullState).toMatchObject({
      foo: "bar",
      groupBy: "name",
      hidePassing: false,
      labels: {
        "canary:DBAdmin:true": 0,
        "canary:high:true": -1
      },
      layout: "table"
    });
    expect(formState).toMatchObject({
      groupBy: "name",
      hidePassing: false,
      labels: {
        "canary:DBAdmin:true": 0,
        "canary:high:true": -1
      },
      layout: "table"
    });
  });
});