UNPKG

904 BJavaScriptView Raw
1// Jasmine tests for public interactions
2
3var CodeGradX = require('../codegradxlib.js');
4var xml2js = require('xml2js').parseString;
5
6describe('CodeGradX', function () {
7
8 it('should be loaded', function () {
9 expect(CodeGradX).toBeDefined();
10 });
11
12 function make_faildone (done) {
13 return function faildone (reason) {
14 agent.state.debug(reason).show();
15 //console.log(reason);
16 fail(reason);
17 done();
18 };
19 }
20
21 it("cannot authenticate with wrong password", function (done) {
22 var state = new CodeGradX.State();
23 var faildone = make_faildone(done);
24 state.getAuthenticatedUser('nobody:0', 'totallyWrong').then(
25 function (user) {
26 console.log(user);
27 faildone();
28 }, function (reason) {
29 expect(reason).toBeDefined();
30 done();
31 });
32 });
33
34});