<commit_before>/*global define, describe, it, expect, beforeEach*/
/*
 * Copyright 2012 Cloud9 IDE, Inc.
 *
 * This product includes software developed by
 * Cloud9 IDE, Inc (http://c9.io).
 *
 * Author: <NAME> <<EMAIL>>
 */

define(['githubjs'], function (Client) {
    'use strict';
    describe('[search]', function () {
        var client;
        var token = '<KEY>';

        beforeEach(function () {
            client = new Client();
            client.authenticate({
                type: 'oauth',
                token: token
            });
        });

        it('should successfully execute GET /legacy/issues/search/:user/:repo/:state/:keyword (issues)', function (done) {
            client.search.issues(
                {
                    user: 'jwebertest',
                    repo: 'forTestUseOnly',
                    state: 'closed',
                    keyword: 'Event'
                },
                function (err, res) {
                    expect(err).toBeNull();
                    expect(res.issues.length).toBe(1);
                    var issue = res.issues[0];
                    expect(issue.title).toBe('Create Event');
                    expect(issue.position).toBe(1);
                    expect(issue.state).toBe('closed');

                    done();
                }
            );
        });

        it('should successfully execute GET /legacy/repos/search/:keyword (repos)', function (done) {
            client.search.repos(
                {
                    keyword: 'pasta',
                    language: 'JavaScript'
                },
                function (err, res) {
                    expect(err).toBeNull();
                    expect(res.repositories.length).toBeGreaterThan(0);
                    expect(res.repositories[0].language).toBe('JavaScript');

                    done();
                }
            );
        });

        it('should successfully execute GET /legacy/user/search/:keyword (users)', function (done) {
            client.search.users({ keyword: 'mikedeboer' },
                function (err, res) {
                    expect(err).toBeNull();
                    expect(res.users.length).toBe(2);
                    var user = res.users[0];
                    expect(user.name).toBe('<NAME>');
                    expect(user.username.indexOf('mikedeboer')).toBe(0);

                    done();
                }
            );
        });

    });
});<commit_msg>* add test for search:code<commit_after>/*global define, describe, it, expect, beforeEach*/
/*
 * Copyright 2012 Cloud9 IDE, Inc.
 *
 * This product includes software developed by
 * Cloud9 IDE, Inc (http://c9.io).
 *
 * Author: <NAME> <<EMAIL>>
 */

define(['githubjs'], function (Client) {
    'use strict';
    describe('[search]', function () {
        var client;
        var token = '<KEY>';

        beforeEach(function () {
            client = new Client();
            client.authenticate({
                type: 'oauth',
                token: token
            });
        });

        it('should successfully execute GET /legacy/issues/search/:user/:repo/:state/:keyword (issues)', function (done) {
            client.search.issues(
                {
                    user: 'jwebertest',
                    repo: 'forTestUseOnly',
                    state: 'closed',
                    keyword: 'Event'
                },
                function (err, res) {
                    expect(err).toBeNull();
                    expect(res.issues.length).toBe(1);
                    var issue = res.issues[0];
                    expect(issue.title).toBe('Create Event');
                    expect(issue.position).toBe(1);
                    expect(issue.state).toBe('closed');

                    done();
                }
            );
        });

        it('should successfully execute GET /legacy/repos/search/:keyword (repos)', function (done) {
            client.search.repos(
                {
                    keyword: 'pasta',
                    language: 'JavaScript'
                },
                function (err, res) {
                    expect(err).toBeNull();
                    expect(res.repositories.length).toBeGreaterThan(0);
                    expect(res.repositories[0].language).toBe('JavaScript');

                    done();
                }
            );
        });

        it('should successfully execute GET /legacy/user/search/:keyword (users)', function (done) {
            client.search.users({ keyword: 'mikedeboer' },
                function (err, res) {
                    expect(err).toBeNull();
                    expect(res.users.length).toBe(2);
                    var user = res.users[0];
                    expect(user.name).toBe('<NAME>');
                    expect(user.username.indexOf('mikedeboer')).toBe(0);

                    done();
                }
            );
        });

        it('should successfully execute GET /legacy/user/search/code ', function (done) {
            client.search.code({
                    q: 'test helper repo:dica-developer/gh-review'
                },
                function (err, res) {
                    expect(err).toBeNull();
                    expect(res.items.length).toBe(3);
                    var result = res.items.shift();
                    expect(result.name).toBe('dev.karma.conf.js');
                    expect(result.path).toBe('test/dev.karma.conf.js');
                    expect(result.sha).toBe('b8854a2711504db327c941b7d2d98555345395f9');

                    done();
                }
            );
        });

    });
});
{'fraction_non_alphanumeric': 0.13527851458885942, 'fraction_numerical': 0.010963748894783378, 'mean_word_length': 1.2778896496173984, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5417562', 'n_tokens_mistral': 1507, 'n_tokens_neox': 1373, 'n_words': 262}