<commit_before>describe('The state token generator factory', function () {
    const byteString = '048>IYceiv{ÈÌÐàð';
    const asciiString = 'abcd+efgh==';

    let $window;
    let stateTokenGenerator;

    beforeEach(function () {
        angular.mock.module(
            'dpShared',
            {
                $window: {
                    crypto: {
                        getRandomValues: (list) => {
                            list[0] = 48; // 0
                            list[1] = 52; // 4
                            list[2] = 56; // 8
                            list[3] = 62; // >
                            list[4] = 73; // I
                            list[5] = 89; // Y
                            list[6] = 99; // c
                            list[7] = 101; // e
                            list[8] = 105; // i
                            list[9] = 118; // v
                            list[10] = 123; // {
                            list[11] = 200; // È
                            list[12] = 204; // Ì
                            list[13] = 208; // Ð
                            list[14] = 224; // à
                            list[15] = 240; // ð
                        }
                    },
                    btoa: angular.noop
                }
            }
        );

        angular.mock.inject(function (_$window_, _stateTokenGenerator_) {
            $window = _$window_;
            stateTokenGenerator = _stateTokenGenerator_;
        });

        spyOn($window, 'btoa').and.returnValue(asciiString);<commit_msg>Restore crypto to window after each test<commit_after>describe('The state token generator factory', function () {
    const byteString = '048>IYceiv{ÈÌÐàð';
    const asciiString = 'abcd+efgh==';

    let $window;
    let stateTokenGenerator;
    let originalCrypto;

    beforeEach(function () {
        angular.mock.module(
            'dpShared',
            {
                $window: {
                    crypto: {
                        getRandomValues: (list) => {
                            list[0] = 48; // 0
                            list[1] = 52; // 4
                            list[2] = 56; // 8
                            list[3] = 62; // >
                            list[4] = 73; // I
                            list[5] = 89; // Y
                            list[6] = 99; // c
                            list[7] = 101; // e
                            list[8] = 105; // i
                            list[9] = 118; // v
                            list[10] = 123; // {
                            list[11] = 200; // È
                            list[12] = 204; // Ì
                            list[13] = 208; // Ð
                            list[14] = 224; // à
                            list[15] = 240; // ð
                        }
                    },
                    btoa: angular.noop
                }
            }
        );

        angular.mock.inject(function (_$window_, _stateTokenGenerator_) {
            $window = _$window_;
            stateTokenGenerator = _stateTokenGenerator_;
        });

        spyOn($window, 'btoa').and.returnValue(asciiString);
        originalCrypto = $window.crypto;
    });

    afterEach(() => {
        $window.crypto = originalCrypto;
{'fraction_non_alphanumeric': 0.1170018281535649, 'fraction_numerical': 0.04204753199268738, 'mean_word_length': 0.8058305830583058, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '2565513', 'n_tokens_mistral': 972, 'n_tokens_neox': 842, 'n_words': 172}