JSFiddle - React, Tailwind, and code Playground
JavaScript
'use strict';
var testHelpers = require('./test-helpers');
var CrowdControl = require('./crowdcontrol');
var expect = testHelpers.expect;
describe("require('./user-roles')", function() {
var UserRoles;
beforeEach(function() {
UserRoles = testHelpers.rewire('/user-roles');
});
it("should export a function.", function() {
expect(UserRoles).to.be.a('function');
});
describe("new UserRoles()", function() {
var userRoles;
beforeEach(function() {
userRoles = new UserRoles('ccUrl', 'namespace', 'environment', 'ccToken', 'authPath');
});
it("should expose '.get()'.", function() {
expect(UserRoles.get, 'UserRoles.get()').to.be.a('function');
});
describe(".get()", function() {
it("should call a new CrowdControl", function() {
// testHelpers.sinon.stub(CrowdControl, "UserRoles");
// userRoles.get;
// //console.log(CrowdControl);
// expect(CrowdControl).to.have.been.called();
});
it("should call a .get() on the new crowd control", function() {
// expect(userRoles.get('get')).to.deep.equal({
// uri: 'http://myhost/base/namespace/auth/path',
// method: 'GET',
// json: true,
// headers: {
// 'cc-environment': 'dev',
// 'cc-crowd-sso-token': 'T0K3N'
// }
// });
});
});
});
});