<commit_before>'use strict';

describe("$fb", function() {

    var provider, service;
    var $window, $timeout;

    beforeEach(module("socialsharing", function($provide, $fbProvider) {
        provider = $fbProvider;

        describe("$fbProvider", function() {
            it("should contain method init", function() {
                expect(provider.init).toBeDefined();
            });
        });

        // initialize
        provider.init(84804589457, {
            locale: 'de_DE',
            test: 'unknown'
        });

        $provide.decorator('$window', function($delegate) {

            $delegate.FB = jasmine.createSpy();
            $delegate.FB.ui = jasmine.createSpy();
            $delegate.FB.XFBML = {
                parse: jasmine.createSpy()
            };

            return $delegate;
        });
    }));

    beforeEach(inject(function($fb, _$window_) {
        service = $fb;
        $window = _$window_;
    }));

    describe("API to match specs:", function() {
        it("should contain method feed", function() {
            expect(service.feed).toBeDefined();
        });

        it("should contain method parse", function() {
            expect(service.parse).toBeDefined();
        });
    });

    describe("share via FB feed:", function() {
        it("should call FB ui", function() {

            service.feed({
                name: "Link name"
            });
            expect($window.FB.ui).toHaveBeenCalled();
        });

        it("do nothing if no params are passed", function() {

            service.feed();
            expect($window.FB.ui.calls.any()).toEqual(false);
        });
    });

    describe("parse XFBML when asked:", function() {
        it("should call FB XFBML parse", function() {

            service.parse();<commit_msg>twit init added and more tests<commit_after>'use strict';

describe("$fb", function() {

    var provider, service;
    var $window, $timeout;

    beforeEach(module("socialsharing", function($provide, $fbProvider) {
        provider = $fbProvider;

        describe("$fbProvider", function() {
            it("should contain method init", function() {
                expect(provider.init).toBeDefined();
            });
        });

        // initialize
        provider.init(84804589457, {
            locale: 'de_DE',
            test: 'unknown'
        });

        $provide.decorator('$window', function($delegate) {

            $delegate.FB = jasmine.createSpy();
            $delegate.FB.ui = jasmine.createSpy();
            $delegate.FB.XFBML = {
                parse: jasmine.createSpy()
            };

            return $delegate;
        });
    }));

    beforeEach(inject(function($fb, _$window_) {
        service = $fb;
        $window = _$window_;
    }));

    describe("API to match specs:", function() {
        it("should contain method feed", function() {
            expect(service.feed).toBeDefined();
        });

        it("should contain method parse", function() {
            expect(service.parse).toBeDefined();
        });
    });

    describe("share via FB feed:", function() {
        it("should call FB ui", function() {

            service.feed({
                name: "<NAME>"
            });
            expect($window.FB.ui).toHaveBeenCalled();
        });
    });

    describe("parse XFBML when asked:", function() {
        it("should call FB XFBML parse", function() {

            service.parse();
{'fraction_non_alphanumeric': 0.1510144927536232, 'fraction_numerical': 0.006376811594202898, 'mean_word_length': 1.8639004149377594, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4665881', 'n_tokens_mistral': 970, 'n_tokens_neox': 907, 'n_words': 193}