UNPKG

dl

Version:

DreamLab Libs

53 lines (48 loc) 2.19 kB
describe("NauthUserServices", function () { var NauthUserServices; var emptyNauthUserProfile; var filledNauthUserServices; var damagedNauthUserServices1; var damagedNauthUserServices2; beforeEach(function () { if (NauthUserServices !== undefined) { emptyNauthUserProfile = new NauthUserServices(); filledNauthUserServices = new NauthUserServices({ 1 : { 1 : 123 }, }); damagedNauthUserServices1 = new NauthUserServices({ 1 : { 1 : null }, }); damagedNauthUserServices2 = new NauthUserServices({ 1 : { app : 123 }, }); } }); it('NauthUserServices can load needed classes', function(){ expect(function(){ NauthUserServices = require(__dirname + '/../../lib/nauth/NauthUserServices.js').NauthUserServices; }).not.toThrow(); }); it("NauthUserServices.hasAccountInApplication", function () { expect(emptyNauthUserProfile.hasAccountInApplication(1,1)).toBeFalsy(); expect(filledNauthUserServices.hasAccountInApplication(1,1)).toBeTruthy(); expect(filledNauthUserServices.hasAccountInApplication()).toBeFalsy(); expect(filledNauthUserServices.hasAccountInApplication(1)).toBeFalsy(); expect(damagedNauthUserServices1.hasAccountInApplication(1,1)).toBeFalsy(); expect(damagedNauthUserServices2.hasAccountInApplication(1,1)).toBeFalsy(); }); it("NauthUserServices.getIdInApplication", function () { expect(emptyNauthUserProfile.getIdInApplication(1,1)).toBe(null); expect(filledNauthUserServices.getIdInApplication(1,1)).toBe(123); expect(filledNauthUserServices.getIdInApplication()).toBe(null); expect(filledNauthUserServices.getIdInApplication(1)).toBe(null); expect(damagedNauthUserServices1.getIdInApplication(1,1)).toBe(null); expect(damagedNauthUserServices2.getIdInApplication(1,1)).toBe(null); }); });