<commit_before>var build   = require('../lib/main'),
    api     = require('../lib/api'),
    request = require('request'),
    user = '<EMAIL>',
    password = '<PASSWORD>';

describe('auth', function() {
    describe('failure', function() {
        it('should report an error in the callback if an incorrect username is used', function() {
            var s = jasmine.createSpy();
            runs(function() {
                build.auth('<EMAIL>', 'balls', s);
            });
            waitsFor(function() { return s.wasCalled; }, 'auth callback');
            runs(function() {
                expect(s).toHaveBeenCalledWith(jasmine.any(Object), null);
            });
        });
        it('should report an error in the callback if an incorrect password is used', function() {
            var s = jasmine.createSpy();
            runs(function() {
                build.auth(user, 'balls', s);
            });
            waitsFor(function() { return s.wasCalled; }, 'auth callback');
            runs(function() {
                expect(s).toHaveBeenCalledWith(jasmine.any(Object), null);
            });
        });
    });

    describe('success', function() {
        it('should return an api object with a token if a correct username and password is used', function() {
            var s = jasmine.createSpy();
            runs(function() {
                build.auth(user, password, s);
            });
            waitsFor(function() { return s.wasCalled; }, 'auth callback');
            runs(function() {
                expect(s).toHaveBeenCalledWith(null, jasmine.any(api));
                expect(s.calls[0].args[1].token).not.toBeNull();
            });
        });
    });
});
<commit_msg>Reword auth.spec.js tests.<commit_after>var build   = require('../lib/main'),
    api     = require('../lib/api'),
    request = require('request'),
    user = '<EMAIL>',
    password = '<PASSWORD>';

describe('auth', function() {
    describe('incorrect username', function() {
        it('should report an error in the callback', function() {
            var s = jasmine.createSpy();
            runs(function() {
                build.auth('<EMAIL>', 'balls', s);
            });
            waitsFor(function() { return s.wasCalled; }, 'auth callback');
            runs(function() {
                expect(s).toHaveBeenCalledWith(jasmine.any(Object), null);
            });
        });
    });

    describe('incorrect password', function() {
        it('should report an error in the callback', function() {
            var s = jasmine.createSpy();
            runs(function() {
                build.auth(user, 'balls', s);
            });
            waitsFor(function() { return s.wasCalled; }, 'auth callback');
            runs(function() {
                expect(s).toHaveBeenCalledWith(jasmine.any(Object), null);
            });
        });
    });

    describe('correct username and password', function() {
        it('should return an API object with a token', function() {
            var s = jasmine.createSpy();
            runs(function() {
                build.auth(user, password, s);
            });
            waitsFor(function() { return s.wasCalled; }, 'auth callback');
            runs(function() {
                expect(s).toHaveBeenCalledWith(null, jasmine.any(api));
                expect(s.calls[0].args[1].token).not.toBeNull();
            });
        });
    });
});

{'fraction_non_alphanumeric': 0.158187134502924, 'fraction_numerical': 0.0011695906432748538, 'mean_word_length': 1.8893581081081081, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3553344', 'n_tokens_mistral': 935, 'n_tokens_neox': 928, 'n_words': 205}