-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests for user class methods, and createAccount()
Also add better error handling for user#email()
- Loading branch information
1 parent
0dfba93
commit da7036c
Showing
5 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const {mwn, bot, expect, setup, teardown} = require('./local_wiki'); | ||
|
||
describe('write methods', async function () { | ||
|
||
before('setup', setup); | ||
after('teardown', teardown); | ||
|
||
let u = new bot.user('Wikiuser2'); | ||
|
||
it('sends message', function () { | ||
return u.sendMessage('Hi', 'Testing from mwn. ~~~~').then(data => { | ||
expect(data).to.be.an('object').which.has.property('result').that.equals('Success'); | ||
}); | ||
}); | ||
|
||
it('sends email', function () { | ||
return expect(u.email('Subject', 'body')).to.be.eventually.rejectedWith(mwn.Error) | ||
.with.property('code').that.equals('noemail'); | ||
}); | ||
|
||
it('block', function () { | ||
return u.block().then(data => { | ||
expect(data).to.be.an('object').that.includes.keys('user', 'userID', 'reason', | ||
'anononly', 'nocreate', 'partial'); | ||
expect(data.user).to.equal('Wikiuser2'); | ||
}); | ||
}); | ||
|
||
it('unblock', function () { | ||
return u.unblock().then(data => { | ||
expect(data).to.be.an('object').that.includes.keys('user', 'id', 'userid', 'reason'); | ||
expect(data.user).to.equal('Wikiuser2'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters