<commit_before>var supertest = require('supertest');
var chai = require('chai');
var expect = chai.expect;
// var api = supertest('https://' + process.env.SYSTEMAPIC_DOMAIN);
var helpers = require('../helpers');
var token = helpers.token;
var httpStatus = require('http-status');
var endpoints = require('../endpoints.js');

// api
var domain = (process.env.MAPIC_DOMAIN == 'localhost') ? 'https://172.17.0.1' : 'https://' + process.env.MAPIC_DOMAIN;
console.log(domain);
var api = supertest(domain);

module.exports = function () {
    describe(endpoints.projects.slug.available, function () {
        it("should respond with status code 401 when not authenticated", function (done) {
            api.post(endpoints.projects.slug.available)
                .send({})
                .expect(httpStatus.UNAUTHORIZED)
                .end(done);
        });

    });
};<commit_msg>should respond with available slug of a project<commit_after>var supertest = require('supertest');
var chai = require('chai');
var expect = chai.expect;
var helpers = require('../helpers');
var token = helpers.token;
var httpStatus = require('http-status');
var endpoints = require('../endpoints.js');

// api
var domain = (process.env.MAPIC_DOMAIN == 'localhost') ? 'https://172.17.0.1' : 'https://' + process.env.MAPIC_DOMAIN;
console.log(domain);
var api = supertest(domain);

module.exports = function () {
    describe(endpoints.projects.slug.available, function () {
        it("should respond with status code 401 when not authenticated", function (done) {
            api.post(endpoints.projects.slug.available)
                .send({})
                .expect(httpStatus.UNAUTHORIZED)
                .end(done);
        });

        it('should respond with available slug of a project', function (done) {
            token(function (err, access_token) {
                api.post(endpoints.projects.slug.available)
                    .send({access_token: access_token , project_name : "Project Name ZZZ" , created_by_username : "admin" })
                    .expect(httpStatus.OK)
                    .end(function (err, res) {
                        if (err) return done(err);
                        var result = helpers.parse(res.text);
                        expect(result.slug).to.be.equal("project-name-zzz");
                        done();
                    });
            });
        });

    });
};
{'fraction_non_alphanumeric': 0.14802494802494803, 'fraction_numerical': 0.008316008316008316, 'mean_word_length': 2.3839662447257384, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, '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': '2116863', 'n_tokens_mistral': 708, 'n_tokens_neox': 679, 'n_words': 150}