<commit_before>/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
*/
describe('Globalization (navigator.globalization)', function () {
    it("globalization.spec.1 should exist", function() {
        expect(navigator.globalization).toBeDefined();
    });
    
    describe("getLocaleName", function() {
        it("globalization.spec.1 should exist", function() {
            expect(typeof navigator.globalization.getLocaleName).toBeDefined();
            expect(typeof navigator.globalization.getLocaleName == 'function').toBe(true);
        });
        it("globalization.spec.3 getLocaleName success callback should be called with a Properties object", function() {
            var win = jasmine.createSpy().andCallFake(function(a) {
                    expect(a).toBeDefined();
                    expect(typeof a).toBe('object');
                    expect(a.value).toBeDefined();
                    expect(typeof a.value).toBe('string');
                    expect(a.value.length > 0).toBe(true);
                }),
                fail = jasmine.createSpy();

            runs(function () {
                navigator.globalization.getLocaleName(win, fail);
            });

            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);

            runs(function () {
                expect(fail).not.toHaveBeenCalled();
            });
        });
    });
    
    describe("dateToString", function() {
        it("globalization.spec.1 should exist", function() {
            expect(typeof navigator.globalization.dateToString).toBeDefined();
            expect(typeof navigator.globalization.dateToString == 'function').toBe(true);
        });
        it("globalization.spec.5 dateToString using default options, success callback should be called with a Properties object", function() {
            var win = jasmine.createSpy().andCallFake(function(a) {
                    expect(a).toBeDefined();
                    expect(typeof a).toBe('object');
                    expect(a.value).toBeDefined();
                    expect(typeof a.value).toBe('string');<commit_msg>[CB-3488] - Fixed Globalization test to add check or Globalization error constants<commit_after>/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
*/
describe('Globalization (navigator.globalization)', function () {
    it("globalization.spec.1 should exist", function() {
        expect(navigator.globalization).toBeDefined();
    });
    
    describe("getLocaleName", function() {
        it("globalization.spec.1 should exist", function() {
            expect(typeof navigator.globalization.getLocaleName).toBeDefined();
            expect(typeof navigator.globalization.getLocaleName == 'function').toBe(true);
        });
        it("globalization.spec.3 getLocaleName success callback should be called with a Properties object", function() {
            var win = jasmine.createSpy().andCallFake(function(a) {
                    expect(a).toBeDefined();
                    expect(typeof a).toBe('object');
                    expect(a.value).toBeDefined();
                    expect(typeof a.value).toBe('string');
                    expect(a.value.length > 0).toBe(true);
                }),
                fail = jasmine.createSpy();

            runs(function () {
                navigator.globalization.getLocaleName(win, fail);
            });

            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);

            runs(function () {
                expect(fail).not.toHaveBeenCalled();
            });
        });
    });
    
    describe('Globalization Constants (window.Globalization)', function () {
        it("globalization.spec.1 should exist", function() {
            expect(window.GlobalizationError).toBeDefined();
            expect(window.GlobalizationError.UNKNOWN_ERROR).toBe(0);
            expect(window.GlobalizationError.FORMATTING_ERROR).toBe(1);
            expect(window.GlobalizationError.PARSING_ERROR).toBe(2);
            expect(window.GlobalizationError.PATTERN_ERROR).toBe(3);
        });
    });
    
    describe("dateToString", function() {
        it("globalization.spec.1 should exist", function() {
            expect(typeof navigator.globalization.dateToString).toBeDefined();
            expect(typeof navigator.globalization.dateToString == 'function').toBe(true);
        });
        it("globalization.spec.5 dateToString using default options, success callback should be called with a Properties object", function() {
            var win = jasmine.createSpy().andCallFake(function(a) {
                    expect(a).toBeDefined();
                    expect(typeof a).toBe('object');
                    expect(a.value).toBeDefined();
                    expect(typeof a.value).toBe('string');
{'fraction_non_alphanumeric': 0.1116382036685642, 'fraction_numerical': 0.004585705249841872, 'mean_word_length': 2.5815402038505098, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4538017', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1530, 'n_words': 430}