<commit_before>import chai, {expect} from 'chai';
import createApp from '../../src/app';
import dbFixtures from '../utils/dbFixtures';

describe('App', function() {
    before(async function() {
        this.timeout(60000);
        await dbFixtures.setup();
    });

    after(async function() {
        await dbFixtures.teardown();
    });


    it('factory (createApp) should be a function', function() {
        expect(createApp).to.exist
            .and.to.be.a('function');
    });

    describe('instance', function() {
        let app;

        before(function() {
            app = createApp({connectionString: dbFixtures.connectionString, schema: 'public'});
        });

        it('should respond to HTTP requests', async function() {
            await chai.request(app)
                .get('/');
        });

        it('should respond with success to "GET /"', async function() {
            const res = await chai.request(app)
                .get('/');
            res.should.have.status(200);
        });
    });

    describe('instance with bad connection string', function() {<commit_msg>Add test for (unimplemented) /rpc route<commit_after>import chai, {expect} from 'chai';
import createApp from '../../src/app';
import dbFixtures from '../utils/dbFixtures';

describe('App', function() {
    before(async function() {
        this.timeout(60000);
        await dbFixtures.setup();
    });

    after(async function() {
        await dbFixtures.teardown();
    });


    it('factory (createApp) should be a function', function() {
        expect(createApp).to.exist
            .and.to.be.a('function');
    });

    describe('instance', function() {
        let app;

        before(function() {
            app = createApp({connectionString: dbFixtures.connectionString, schema: 'public'});
        });

        it('should respond to HTTP requests', async function() {
            await chai.request(app)
                .get('/');
        });

        it('should respond with success to "GET /"', async function() {
            const res = await chai.request(app)
                .get('/');
            res.should.have.status(200);
        });

        describe('/rpc', function() {
            // TODO: implement rpc routes. In the mean time let's check that they're reserved.
            it('should not allow requests while feature is not implemented', async function() {
                await chai.request(app)
                    .get('/rpc')
                    .should.eventually.be.rejected;
                await chai.request(app)
                    .get('/rpc/whatever')
                    .should.eventually.be.rejected;
            });
        });
    });

    describe('instance with bad connection string', function() {
{'fraction_non_alphanumeric': 0.1457049655672345, 'fraction_numerical': 0.005799202609641174, 'mean_word_length': 1.9837837837837837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1847777', 'n_tokens_mistral': 758, 'n_tokens_neox': 725, 'n_words': 185}