"use strict";

var testConfig = require('../config');
var APIv1 = require('../../../src/doctor/include/endpoints').APIv1;

var should = require("should");
var server = require('supertest').agent(testConfig.host);

describe('API: User', function () {
    describe('when login with correct params', function () {
        it('should return 200', function (done) {
            var path = APIv1.Users.Base + APIv1.Users.Login + "?user_id=0de7295862dd11e69faffa163e8aee56&token=0PFWlKmLBN9YzhCfFWVgYA&client_id=H6FYbDejks6VjMmW3uH7V6&platform=0";

            server.get(path)
                .expect(200)
                .end(done);
        })
    });

    describe('when login without user_id', function () {
        it('should return 406', function (done) {
            var path = APIv1.Users.Base + APIv1.Users.Login + "?token=0PFWlKmLBN9YzhCfFWVgYA&client_id=H6FYbDejks6VjMmW3uH7V6&platform=0";

            server.get(path)
                .expect(406, done);
        });
    });

    describe('when login without client_id', function () {
        it('should return 406', function (done) {
            var path = APIv1.Users.Base + APIv1.Users.Login + "?user_id=0de7295862dd11e69faffa163e8aee56&token=0PFWlKmLBN9YzhCfFWVgYA&platform=0";

            server.get(path)
                .expect(406, done);
        });
    });

    describe('when login without token', function () {
        it('should return 406', function (done) {
            var path = APIv1.Users.Base + APIv1.Users.Login + "?user_id=0de7295862dd11e69faffa163e8aee56&token=0PFWlKmLBN9YzhCfFWVgYA&platform=0";

            server.get(path)
                .expect(406, done);
        });
    });

    describe('when login without platform', function () {
        it('should return 406', function (done) {
            var path = APIv1.Users.Base + APIv1.Users.Login + "?token=0PFWlKmLBN9YzhCfFWVgYA&client_id=H6FYbDejks6VjMmW3uH7V6";

            server.get(path)
                .expect(406, done);
        });
    });

    describe('when update user status', function () {
        it('should return 200', function (done) {
            var path = APIv1.Users.Base + "/0de7295862dd11e69faffa163e8aee56/status";

            server.post(path)
                .set('Content-Type', 'application/json')
                .set('X-HTTP-Method-Override', 'POST')
                .send({status: 1})
                .expect(200, done);
        });
    });

    describe('when user logout', function () {
        it('should return 200', function (done) {
            var path = APIv1.Users.Base + APIv1.Users.Logout + "?user_id=0de7295862dd11e69faffa163e8aee56";

            server.get(path)
                .expect(200, done);
        });
    });
});
