<commit_before>describe('The earthmine-data-formatter service', function () {
    var earthmineDataFormatter,
        input,
        output;

    beforeEach(function () {
        angular.mock.module(
            'dpStraatbeeld'
        );

        angular.mock.inject(function (_earthmineDataFormatter_) {
            earthmineDataFormatter = _earthmineDataFormatter_;
        });

        input = {
            'pano-id': '1000014016370',
            timestamp: '2012-07-15 13:27:32',
            location: {
                lon: 4.9219423482803,
                lat: 52.37672892191
            },
            'pano-orientation': {
                yaw: 11.744057655334,
                pitch: 3.5506110191345
            },
            connections: [
                {
                    'relative-location': {
                        yaw: -168.26495451758,
                        pitch: -0.46371610026191,
                        distance: 5.4100728048995
                    },
                    'pano-id': '1000014016369'
                },
                {
                    'relative-location': {
                        yaw: 14.56514641488,
                        pitch: 0.3063689539213,
                        distance: 5.4159216166952
                    },
                    'pano-id': '1000014016371'
                }
            ]
        };

        output = earthmineDataFormatter.formatPanoramaState(input);
    });

    it('restructes data from earthmine', function () {
        expect(output.id).toBeDefined();
        expect(output.date).toBeDefined();
        expect(output.car.location).toEqual([52.37672892191, 4.9219423482803]);
    });

    it('converts the id from a String to a Number', function () {
        expect(angular.isString(input['pano-id'])).toBe(true);
        expect(input['pano-id']).toBe('1000014016370');

        expect(angular.isNumber(output.id)).toBe(true);
        expect(output.id).toBe(1000014016370);
    });

    it('converts the date from a String to a Date object', function () {
        expect(angular.isString(input.timestamp)).toBe(true);

        expect(angular.isDate(output.date)).toBe(true);
        expect(output.date.getFullYear()).toBe(2012);
        expect(output.date.getMonth()).toBe(6);
        expect(output.date.getDate()).toBe(15);
    });
});<commit_msg>Unit tests for the hotspot data structure.<commit_after>describe('The earthmine-data-formatter service', function () {
    var earthmineDataFormatter,
        input,
        output;

    beforeEach(function () {
        angular.mock.module(
            'dpStraatbeeld',
            {
                angleConversion: {
                    degreesToRadians: function (input) {
                        return input - 1;
                    }
                }
            }
        );

        angular.mock.inject(function (_earthmineDataFormatter_) {
            earthmineDataFormatter = _earthmineDataFormatter_;
        });

        input = {
            'pano-id': '1000014016370',
            timestamp: '2012-07-15 13:27:32',
            location: {
                lon: 4.9219423482803,
                lat: 52.37672892191
            },
            'pano-orientation': {
                yaw: 11.744057655334,
                pitch: 3.5506110191345
            },
            connections: [
                {
                    'relative-location': {
                        yaw: 1,
                        pitch: 2,
                        distance: 3
                    },
                    'pano-id': '1000014016369'
                },
                {
                    'relative-location': {
                        yaw: 7,
                        pitch: 8,
                        distance: 9
                    },
                    'pano-id': '1000014016371'
                }
            ]
        };

        output = earthmineDataFormatter.formatPanoramaState(input);
    });

    it('restructes data from earthmine', function () {
        expect(output.id).toBeDefined();
        expect(output.date).toBeDefined();
        expect(output.car.location).toEqual([52.37672892191, 4.9219423482803]);
    });

    it('converts the id from a String to a Number', function () {
        expect(angular.isString(input['pano-id'])).toBe(true);
        expect(input['pano-id']).toBe('1000014016370');

        expect(angular.isNumber(output.id)).toBe(true);
        expect(output.id).toBe(1000014016370);
    });

    it('converts the date from a String to a Date object', function () {
        expect(angular.isString(input.timestamp)).toBe(true);

        expect(angular.isDate(output.date)).toBe(true);
        expect(output.date.getFullYear()).toBe(2012);
        expect(output.date.getMonth()).toBe(6);
        expect(output.date.getDate()).toBe(15);
    });

    describe('hotspots', function () {
        it('convert the IDs from String to Number', function () {
            expect(output.hotspots[0].id).toBe(1000014016369);
            expect(output.hotspots[1].id).toBe(1000014016371);
        });

        it('converts the yaw and pitch from degrees to radians', function () {
            expect(output.hotspots[0].relativeLocation.yaw).toBe(0);
            expect(output.hotspots[0].relativeLocation.pitch).toBe(1);

            expect(output.hotspots[1].relativeLocation.yaw).toBe(6);
            expect(output.hotspots[1].relativeLocation.pitch).toBe(7);
        });

        it('has a distance property for each hotspot', function () {
            expect(output.hotspots[0].relativeLocation.distance).toBe(3);
            expect(output.hotspots[1].relativeLocation.distance).toBe(9);
        });
    });
});
{'fraction_non_alphanumeric': 0.12590372068418268, 'fraction_numerical': 0.0823487921001587, 'mean_word_length': 1.5840546697038724, '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': '6544195', 'n_tokens_mistral': 1897, 'n_tokens_neox': 1532, 'n_words': 231}