<commit_before>var helper = require('../lib');
var request = helper.getRequest();

describe('Auto OPTIONS', function(){

    before(function (done) {
        helper.drakov.run({sourceFiles: 'test/example/md/headers.md', autoOptions: true}, done);
    });

    after(function (done) {
        helper.drakov.stop(done);
    });

    describe('/headers', function() {
        it('should respond for OPTIONS despite its not defined in api blueprint', function (done) {
            request.options('/headers')
                .expect(200)
                .end(helper.endCb(done));
        });
    });

    describe('/fjselifjsleifjselij', function(){
        it('should not respond for OPTIONS for every path', function(done){
            request.options('/fjselifjsleifjselij')
                .expect(404)
                .end(helper.endCb(done));
        });

    });

});<commit_msg>Auto options test uses simple api example and tests if drakov doesn't override OPTIONS from api blueprint.<commit_after>var helper = require('../lib');
var request = helper.getRequest();

describe('Auto OPTIONS', function () {

    before(function (done) {
        helper.drakov.run({sourceFiles: 'test/example/md/simple-api.md', autoOptions: true}, done);
    });

    after(function (done) {
        helper.drakov.stop(done);
    });

    it('should respond for OPTIONS despite its not defined in api blueprint', function (done) {
        request.options('/api/things/2')
            .expect(200)
            .expect('Access-Control-Allow-Origin', '*')
            .end(helper.endCb(done));
    });

    it('should not override OPTIONS route specified in api blueprint', function (done) {
        request.options('/api/things')
            .expect(200)
            .expect('Access-Control-Allow-Origin', 'custom-domain.com')
            .end(helper.endCb(done));
    });

    it('should not respond for OPTIONS for paths missing in api blueprint', function (done) {
        request.options('/fjselifjsleifjselij')
            .expect(404)
            .end(helper.endCb(done));
    });

});
{'fraction_non_alphanumeric': 0.14905933429811866, 'fraction_numerical': 0.007718282682103232, 'mean_word_length': 2.533219761499148, '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': '3854826', 'n_tokens_mistral': 622, 'n_tokens_neox': 583, 'n_words': 135}