'use strict';

 describe('Service: sentimentMemoryAnnotation', function () {

    // load the service's module

    // instantiate service
    var sentimentMemoryAnnotation;
    var $httpBackend;

    beforeEach(inject(function ($injector) {
	sentimentMemoryAnnotation = $injector.get('SentimentMemoryAnnotation');
	$httpBackend = $injector.get('$httpBackend');
    }));

     describe('getAllCategory()', function () {	
	 var result;
	 
	 beforeEach(function (done) {
	     $httpBackend.whenGET(buildDistinctUrl(
		 {},
		 'category',
		 'annotations'
	     )).respond(200, ["test"]);

	     sentimentMemoryAnnotation
		 .getAllCategory()
		 .then(function (_categories) {
		     result = _categories;
		     done();
		 });

	     $httpBackend.flush();
	 });

     });

    describe('updateStatus()', function () {
	var result;

	beforeEach(function (done) {
	    var url = URL_PREFIX + '/annotations/test?\"{\"query\":null,\"update\":{\"+$set\":{\"status\":1}},\"options\":{}}"';
	    console.log(url);

	    $httpBackend.whenPUT(url).respond(200);

	    sentimentMemoryAnnotation
		.updateStatus({
		    _id: "test"
		}, 1)
		.then(function (_result) {
		    result = _result;
		    done();
		});

	    $httpBackend.flush();
	});

    });
});
