<commit_before>/* globals describe it expect afterEach beforeEach */
jest.mock("../main/DevToggles.es6");
import React from "react";
import {Header, HeaderLinks, mapStateToProps} from "Header.es6";
import * as TestUtils from "../test/testsupport/TestUtils.es6";
import {shallow} from "enzyme";
import R from "ramda";
import DevToggleMock from "DevToggles.es6";

DevToggleMock.showPipelineTour = false;

describe("Header", () => {

    let realConsole;

    beforeEach(() => {
        // TestUtils.consoleThrowingBefore(realConsole);
    });

    afterEach(() => {
        // TestUtils.consoleThrowingAfter(realConsole);
    });

    const wrapDefaultValues = (input) => R.merge({showStartBuildButton: true}, input);

    describe("start build button", () => {
        it("should show start build button", () => {
            const component = shallow(<Header pipelineName={"Test"} showStartBuildButton={true} links={[]}/>);
            expect(component.find(".runButton").length).toBe(1);
        });

        it("should hide start build button", () => {
            const component = shallow(<Header pipelineName={"Test"} showStartBuildButton={false} links={[]}/>);
            expect(component.find(".runButton").length).toBe(0);
        });
    });

    describe("Navbar Links", () => {
        it("should return one html link", () => {
            const component = HeaderLinks({links: [{url: "http://", text: "Link"}]});
            expect(component).toEqual(<div className="linksHeader"><a target="_blank" key="http://"
                                                                      href="http://">Link</a></div>);
        });

        it("should return two html links", () => {
            const component = HeaderLinks({links: [{url: "http://", text: "Link1"}, {url: "https://", text: "Link2"}]});
            expect(component).toEqual(<div className="linksHeader"><a target="_blank" key="http://"
                                                                      href="http://">Link1</a><a target="_blank"
                                                                                                 key="https://"
                                                                                                 href="https://">Link2</a>
            </div>);
        });


        it("should return null, when emty array in links available", () => {
            const component = HeaderLinks({links: []});
            expect(component).toEqual(null);
        });

        it("should return null, wenn no links in state available", () => {
            const component = HeaderLinks();
            expect(component).toEqual(null);
        });
    });

    describe("Header redux", () => {
        it("should get config", () => {
            const state = {config: {name: "Pipeline", navbar: {links: [{url: "http...", name: "Name"}]}}};
            const expected = wrapDefaultValues({pipelineName: "Pipeline", links: [{url: "http...", name: "Name"}]});
            expect(mapStateToProps(state)).toEqual(expected);
        });

        it("should get emty array for links, when no links available", () => {
            const state = {config: {name: "Pipeline", navbar: {}}};
            const expected = wrapDefaultValues({pipelineName: "Pipeline", links: []});
            expect(mapStateToProps(state)).toEqual(expected);
        });

        it("should get emty array for links, when no navbar available", () => {
            const state = {config: {name: "Pipeline"}};
            const expected = wrapDefaultValues({pipelineName: "Pipeline", links: []});
            expect(mapStateToProps(state)).toEqual(expected);
        });
    });
});



<commit_msg>reenable proptype validation check in test<commit_after>/* globals describe it expect afterEach beforeEach jest */
jest.mock("../main/DevToggles.es6");
import React from "react";
import {Header, HeaderLinks, mapStateToProps} from "Header.es6";
import * as TestUtils from "../test/testsupport/TestUtils.es6";
import {shallow} from "enzyme";
import R from "ramda";
import DevToggleMock from "DevToggles.es6";

DevToggleMock.showPipelineTour = false;

describe("Header", () => {

    let realConsole;

    beforeEach(() => {
        TestUtils.consoleThrowingBefore(realConsole);
    });

    afterEach(() => {
        TestUtils.consoleThrowingAfter(realConsole);
    });

    const wrapDefaultValues = (input) => R.merge({showStartBuildButton: true}, input);

    describe("start build button", () => {
        it("should show start build button", () => {
            const component = shallow(<Header pipelineName={"Test"} showStartBuildButton={true} links={[]}/>);
            expect(component.find(".runButton").length).toBe(1);
        });

        it("should hide start build button", () => {
            const component = shallow(<Header pipelineName={"Test"} showStartBuildButton={false} links={[]}/>);
            expect(component.find(".runButton").length).toBe(0);
        });
    });

    describe("Navbar Links", () => {
        it("should return one html link", () => {
            const component = HeaderLinks({links: [{url: "http://", text: "Link"}]});
            expect(component).toEqual(<div className="linksHeader"><a target="_blank" key="http://"
                                                                      href="http://">Link</a></div>);
        });

        it("should return two html links", () => {
            const component = HeaderLinks({links: [{url: "http://", text: "Link1"}, {url: "https://", text: "Link2"}]});
            expect(component).toEqual(<div className="linksHeader"><a target="_blank" key="http://"
                                                                      href="http://">Link1</a><a target="_blank"
                                                                                                 key="https://"
                                                                                                 href="https://">Link2</a>
            </div>);
        });


        it("should return null, when emty array in links available", () => {
            const component = HeaderLinks({links: []});
            expect(component).toEqual(null);
        });

        it("should return null, wenn no links in state available", () => {
            const component = HeaderLinks();
            expect(component).toEqual(null);
        });
    });

    describe("Header redux", () => {
        it("should get config", () => {
            const state = {config: {name: "Pipeline", navbar: {links: [{url: "http...", name: "Name"}]}}};
            const expected = wrapDefaultValues({pipelineName: "Pipeline", links: [{url: "http...", name: "Name"}]});
            expect(mapStateToProps(state)).toEqual(expected);
        });

        it("should get emty array for links, when no links available", () => {
            const state = {config: {name: "Pipeline", navbar: {}}};
            const expected = wrapDefaultValues({pipelineName: "Pipeline", links: []});
            expect(mapStateToProps(state)).toEqual(expected);
        });

        it("should get emty array for links, when no navbar available", () => {
            const state = {config: {name: "Pipeline"}};
            const expected = wrapDefaultValues({pipelineName: "Pipeline", links: []});
            expect(mapStateToProps(state)).toEqual(expected);
        });
    });
});




{'fraction_non_alphanumeric': 0.1672077922077922, 'fraction_numerical': 0.0027056277056277055, 'mean_word_length': 2.09979035639413, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 59, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7540554', 'n_tokens_mistral': 1862, 'n_tokens_neox': 1830, 'n_words': 438}