<commit_before>const assert = require('chai').assert;
const sqreen = require('../../lib/utils/sqreen');

describe('sqreen api', () => {

    it('screens an email and returns risk assessment with a VALID email address', () => {
        const testEmail = '<EMAIL>';

        return sqreen.sqreenEmail(testEmail)
            .then(res => {
                assert.equal(res.email, testEmail);
                assert.exists(res.risk_score);
            });
    });

    it('screens an email returns NOT FOUND with an INVALID email address', () => {
        const testEmail = '#';

        return sqreen.sqreenEmail(testEmail)
            .then(() => {
                throw new Error('should have returned an error but did not');
            }, res => {
                assert.equal(res.status, 404);
                assert.equal(res.message, 'Not Found');
            });
    });

    it('screens an ip returns risk assessment with VALID ip address', () => {
        const testIp = '172.16.58.3';

        return sqreen.sqreenIp(testIp)
            .then(res => {
                assert.equal(res.ip, testIp);
                assert.exists(res.risk_score);
            });
    });

    it('screens an ip returns NOT FOUND with an INVALID ip address', () => {
        const testIp = '';

        return sqreen.sqreenIp(testIp)
            .then(() => {
                throw new Error('should have returned an error but did not');
            }, res => {
                assert.equal(res.status, 404);
                assert.equal(res.message, 'Not Found');
            });
    });

    it('screens an ip returns BAD REQUEST with an INVALID ip address', () => {
        const testIp = 'BLAH';

        return sqreen.sqreenIp(testIp)
            .then(() => {
                throw new Error('should have returned an error but did not');
            }, res => {
                assert.equal(res.status, 400);
                assert.equal(res.message, 'Bad Request');
            });
    });

});<commit_msg>added travis env<commit_after>const assert = require('chai').assert;
const sqreen = require('../../lib/utils/sqreen');

if(process.env.CI != true && process.env.TRAVIS != true) {

    describe('sqreen api', () => {

        it('screens an email and returns risk assessment with a VALID email address', () => {
            const testEmail = '<EMAIL>';

            return sqreen.sqreenEmail(testEmail)
                .then(res => {
                    assert.equal(res.email, testEmail);
                    assert.exists(res.risk_score);
                });
        });

        it('screens an email returns NOT FOUND with an INVALID email address', () => {
            const testEmail = '#';

            return sqreen.sqreenEmail(testEmail)
                .then(() => {
                    throw new Error('should have returned an error but did not');
                }, res => {
                    assert.equal(res.status, 404);
                    assert.equal(res.message, 'Not Found');
                });
        });

        it('screens an ip returns risk assessment with VALID ip address', () => {
            const testIp = '172.16.58.3';

            return sqreen.sqreenIp(testIp)
                .then(res => {
                    assert.equal(res.ip, testIp);
                    assert.exists(res.risk_score);
                });
        });

        it('screens an ip returns NOT FOUND with an INVALID ip address', () => {
            const testIp = '';

            return sqreen.sqreenIp(testIp)
                .then(() => {
                    throw new Error('should have returned an error but did not');
                }, res => {
                    assert.equal(res.status, 404);
                    assert.equal(res.message, 'Not Found');
                });
        });

        it('screens an ip returns BAD REQUEST with an INVALID ip address', () => {
            const testIp = 'BLAH';

            return sqreen.sqreenIp(testIp)
                .then(() => {
                    throw new Error('should have returned an error but did not');
                }, res => {
                    assert.equal(res.status, 400);
                    assert.equal(res.message, 'Bad Request');
                });
        });

    });
}
{'fraction_non_alphanumeric': 0.13336463958675746, 'fraction_numerical': 0.007983094623150975, 'mean_word_length': 1.5251926496739774, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2328855', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1088, 'n_words': 296}