Skip to content
Open

321 #380

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion mocha.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ chai.Assertion.addMethod('haveDuplicates', function() {
dups.push(member)
}
})

this.assert(
dups.length !== 0,
"expected #{this} to have duplicates",
Expand All @@ -85,3 +85,27 @@ chai.Assertion.addMethod('haveDuplicates', function() {
dups // actual
);
})
global.createWebserverAgent = function(){
const agent = chai.request.agent(webServer)
agent.loginAs = function(user, callback){
return this
.post('/__login')
.send(user)
.end(function(error, response){
if (error) return callback(error)
//expect(this).to.have.cookie('__user');
callback(null, callback)
})
}
agent.loginAsLearner = function(callback){
return this.loginAs({
id: 'FAKE_USER_ID',
handle: 'Fake_User',
name: 'Fake User',
handle: 'fakeuser',
isAdmin: true,
roles: ['learner', 'admin'],
}, callback)
}
return agent
}
Loading