"use strict";

import { LayoutProcessor } from "./LayoutProcessor.js";
import { LayoutProcessorsStore } from "./LayoutProcessorsStore.js";
import { CommandName } from "../interfaces/CommandName.js";
describe('Layout processor', () => {
  let uut;
  let layoutProcessorsStore;
  beforeEach(() => {
    layoutProcessorsStore = new LayoutProcessorsStore();
    uut = new LayoutProcessor(layoutProcessorsStore);
  });
  it('do nothing when store is empty', () => {
    const layout = {
      component: {
        name: 'component'
      }
    };
    uut.process(layout, CommandName.SetRoot);
    expect(layout).toEqual({
      component: {
        name: 'component'
      }
    });
  });
  it('manipulates layout with external processor', () => {
    const layout = {
      component: {
        name: 'component'
      }
    };
    layoutProcessorsStore.addProcessor((_layout, commandName) => {
      return {
        component: {
          name: 'component1',
          passProps: {
            commandName
          }
        }
      };
    });
    const result = uut.process(layout, CommandName.SetRoot);
    expect(result).toEqual({
      component: {
        name: 'component1',
        passProps: {
          commandName: CommandName.SetRoot
        }
      }
    });
  });
});
//# sourceMappingURL=LayoutProcessor.test.js.map