<commit_before>describe('The state url conversion definition', function () {
    let STATE_URL_CONVERSION;

    beforeEach(function () {
        angular.mock.module('atlas', {});

        angular.mock.inject(function (_STATE_URL_CONVERSION_) {
            STATE_URL_CONVERSION = _STATE_URL_CONVERSION_;
        });
    });

    describe('The registered state initialisation methods', function () {
        it('initialize a state to the home page and default map, (only) on an empty payload', function () {
            let state;

            state = STATE_URL_CONVERSION.onCreate.DEFAULT({}, {}, {}, STATE_URL_CONVERSION.initialValues);
            expect(state).toEqual({
                atlas: {
                    isPrintMode: false
                },
                page: {
                    name: 'home'
                },
                layerSelection: {
                    isEnabled: false
                },
                map: {
                    viewCenter: [52.3719, 4.9012],
                    baseLayer: 'topografie',
                    zoom: 9,
                    overlays: [],
                    isFullscreen: false,
                    isLoading: false,
                    showActiveOverlays: false,
                    drawingMode: null
                }
            });

            state = STATE_URL_CONVERSION.onCreate.DEFAULT({}, {}, {aap: 'noot'}, {});
            expect(state).toEqual({atlas: undefined, page: undefined, layerSelection: undefined});
        });

        it('initialize a search state to the previous search state if it exists', function () {
            let state;

            state = STATE_URL_CONVERSION.onCreate.search({aap: 'noot'}, {});
            expect(state).toEqual({aap: 'noot'});

            state = STATE_URL_CONVERSION.onCreate.search(null, {mies: 'teun'});
            expect(state).toEqual({mies: 'teun'});
        });
    });

    describe('The registered post processing methods', function () {
        describe('The post processing for dataSelection', function () {
            it('copies markers and isLoading from old state and determines fullscreen mode', function () {
                let oldState,
                    newState;

                oldState = {
                    markers: 'aap',
                    isLoading: 'noot',
                    something: 'else'
                };
                newState = {
                    view: 'LIST'
                };

                STATE_URL_CONVERSION.post.dataSelection(oldState, newState);
                expect(newState).toEqual({
                    markers: 'aap',
                    isLoading: 'noot',
                    view: 'LIST',
                    isFullscreen: false
                });

                oldState = null;
                newState = {
                    view: 'TABLE'
                };

                STATE_URL_CONVERSION.post.dataSelection(oldState, newState);
                expect(newState).toEqual({
                    view: 'TABLE',
                    isFullscreen: true
                });
            });
        });

        describe('The post processing for detail', function () {
            it('copies display, geometry, isLoading and isFullscreen from old state if equal endpoint', function () {
                let oldState,
                    newState;

                oldState = {
                    endpoint: 1,
                    display: 'aap',
                    geometry: 'noot',
                    isLoading: 'mies',
                    isFullscreen: 'wim',
                    something: 'else'
                };
                newState = {
                    endpoint: 1
                };

                STATE_URL_CONVERSION.post.detail(oldState, newState);
                expect(newState).toEqual({
                    endpoint: 1,
                    display: 'aap',
                    geometry: 'noot',
                    isLoading: 'mies',
                    isFullscreen: 'wim'
                });

                newState = {
                    endpoint: 2
                };<commit_msg>Coverage state-url conversion<commit_after>describe('The state url conversion definition', function () {
    let STATE_URL_CONVERSION;

    beforeEach(function () {
        angular.mock.module('atlas', {});

        angular.mock.inject(function (_STATE_URL_CONVERSION_) {
            STATE_URL_CONVERSION = _STATE_URL_CONVERSION_;
        });
    });

    describe('The registered state initialisation methods', function () {
        it('initialize a state to the home page and default map, (only) on an empty payload', function () {
            let state;

            state = STATE_URL_CONVERSION.onCreate.DEFAULT({}, {}, {}, STATE_URL_CONVERSION.initialValues);
            expect(state).toEqual({
                atlas: {
                    isPrintMode: false
                },
                page: {
                    name: 'home'
                },
                layerSelection: {
                    isEnabled: false
                },
                map: {
                    viewCenter: [52.3719, 4.9012],
                    baseLayer: 'topografie',
                    zoom: 9,
                    overlays: [],
                    isFullscreen: false,
                    isLoading: false,
                    showActiveOverlays: false,
                    drawingMode: null
                }
            });

            state = STATE_URL_CONVERSION.onCreate.DEFAULT({}, {}, {aap: 'noot'}, {});
            expect(state).toEqual({atlas: undefined, page: undefined, layerSelection: undefined});
        });

        it('initialize a search state to the previous search state if it exists', function () {
            let state;

            state = STATE_URL_CONVERSION.onCreate.search({aap: 'noot'}, {});
            expect(state).toEqual({aap: 'noot'});

            state = STATE_URL_CONVERSION.onCreate.search(null, {mies: 'teun'});
            expect(state).toEqual({mies: 'teun'});
        });
    });

    describe('The registered post processing methods', function () {
        describe('The post processing for dataSelection', function () {
            it('copies markers and isLoading from old state and determines fullscreen mode', function () {
                let oldState,
                    newState;

                oldState = {
                    markers: 'aap',
                    isLoading: 'noot',
                    something: 'else'
                };
                newState = {
                    view: 'LIST'
                };

                STATE_URL_CONVERSION.post.dataSelection(oldState, newState);
                expect(newState).toEqual({
                    markers: 'aap',
                    isLoading: 'noot',
                    view: 'LIST',
                    isFullscreen: false
                });

                oldState = null;
                newState = {
                    view: 'TABLE'
                };

                STATE_URL_CONVERSION.post.dataSelection(oldState, newState);
                expect(newState).toEqual({
                    view: 'TABLE',
                    isFullscreen: true
                });
            });
        });

        describe('The post processing for map', function () {
            it('copies the drawing mode from the previous state', function () {
                let oldState = {
                    drawingMode: 'aap'
                };
                let newState = {};

                STATE_URL_CONVERSION.post.map(oldState, newState);
                expect(newState).toEqual({
                    drawingMode: 'aap'
                });

                oldState = null;
                newState = {};

                STATE_URL_CONVERSION.post.map(oldState, newState);
                expect(newState).toEqual({});
            });
        });

        describe('The post processing for detail', function () {
            it('copies display, geometry, isLoading and isFullscreen from old state if equal endpoint', function () {
                let oldState,
                    newState;

                oldState = {
                    endpoint: 1,
                    display: 'aap',
                    geometry: 'noot',
                    isLoading: 'mies',
                    isFullscreen: 'wim',
                    something: 'else'
                };
                newState = {
                    endpoint: 1
                };

                STATE_URL_CONVERSION.post.detail(oldState, newState);
                expect(newState).toEqual({
                    endpoint: 1,
                    display: 'aap',
                    geometry: 'noot',
                    isLoading: 'mies',
                    isFullscreen: 'wim'
                });

                newState = {
                    endpoint: 2
                };
{'fraction_non_alphanumeric': 0.10074290859972986, 'fraction_numerical': 0.0036019810895992796, 'mean_word_length': 1.199801931171082, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1793266', 'n_tokens_mistral': 2231, 'n_tokens_neox': 2017, 'n_words': 470}