UNPKG

cs-mpx-dataservice

Version:

MPX Dataservices

52 lines (41 loc) 1.75 kB
/** * Created by paul.rangel on 4/27/15. */ var expect = require("chai").expect; var Endpoint = require("../lib/endpoint"); var should = require("should"); var accountToken = require("./data/accountToken"); var categoryId = "http://data.media.sandbox.theplatform.com/media/data/Category/31507363"; describe("Endpoint:", function() { describe("registerEndpoint()", function() { it("Should add an endpoint with the name Feed", function () { Endpoint.register("Feed", 'Feeds Service', '1.0', '/'); Endpoint.getEndpoints().should.have.property("Feed"); }); }); describe("registerDataServiceEndpoint()", function() { it("Should add a dataService endpoint with the name Category ", function () { Endpoint.registerDataService("Category", 'Media Data Service', '1.7.0', 'Category'); Endpoint.getEndpoints().should.have.property("Category"); }); }); describe("init()", function() { it("Should load registry on init", function (done) { Endpoint.init(accountToken.account, accountToken.token).then(function(endpoints) { //console.log("endpoints: ",endpoints); endpoints.should.have.property("Feed"); endpoints.should.have.property("Category"); done(); }, function(err) { console.log("err: ", err); }); }); }); describe("getEndpoint()", function() { it("Should return an endpoint with the populated data", function () { var Category = Endpoint.getEndpoint("Feed"); Category.should.have.property('url'); //Category.url.should.be.equal(categoryId); }); }); });