cluedin-widget
Version:
This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.
92 lines (82 loc) • 2.92 kB
JavaScript
var should = require('should');
var mongoose = require('mongoose');
mongoose.connect('mongodb://dbo:lollol@dogen.mongohq.com:10060/cluedin_invite');
var wmsBackend = require('../../wmsBackend');
describe('Given the WMS Backend', () => {
it('should exist', function () {
wmsBackend.should.exist;
});
it('should have a getConfiguration method', () => {
wmsBackend.getConfiguration.should.exist;
});
it('should have a getUserProfile method', () => {
wmsBackend.getUserProfile.should.exist;
});
it('should have a addWdigetToUserProfile method', () => {
wmsBackend.addWidgetToUserProfile.should.exist;
});
it('should have a addWdigetToUserProfile method', () => {
wmsBackend.saveUserProfile.should.exist;
});
describe('and a UserProfile', () => {
var uniqueIdForUserProfile = new Date().getTime();
const userProfile = {
userId: uniqueIdForUserProfile,
isOnBoardingFinished: true,
};
after((done) => {
wmsBackend.removeUserProfile(uniqueIdForUserProfile, (err) => {
(err === void 0).should.be.true;
done();
});
});
it('should be able to save a userProfile', (done) => {
wmsBackend.saveUserProfile(userProfile, (err) => {
(err === void 0).should.be.true;
done();
});
});
describe('and when I want to get it', () => {
it('should work', () => {
wmsBackend.getUserProfile(uniqueIdForUserProfile, (err, userProfile) => {
(err === void 0).should.be.true;
userProfile.should.exist;
userProfile.userId.should.equal('' + uniqueIdForUserProfile);
});
});
it('should be able to add a widget', (done) => {
wmsBackend.addWidgetToUserProfile('altech', uniqueIdForUserProfile, {
entityType: '/Organization',
name: 'LastDocuments',
place: 'main',
isAdmin: false,
}, (err, userProfileBackFromSave) => {
(err === void 0).should.be.true;
(userProfileBackFromSave.widgetConfiguration.length > 0).should.be.true;
done();
});
});
});
});
describe('when I want to add a widget to a userProfile not existing', () => {
var uniqueIdWhenWidgetNotExisting = new Date().getTime() + '2';
after((done) => {
wmsBackend.removeUserProfile(uniqueIdWhenWidgetNotExisting, (err) => {
(err === void 0).should.be.true;
done();
});
});
it('should be able to add a widget', (done) => {
wmsBackend.addWidgetToUserProfile('altech', uniqueIdWhenWidgetNotExisting, {
entityType: '/Organization',
name: 'LastDocuments',
place: 'main',
isAdmin: false,
}, (err, userProfileBackFromSave) => {
(err === void 0).should.be.true;
(userProfileBackFromSave.widgetConfiguration.length > 0).should.be.true;
done();
});
});
});
});