Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yuhongda
committed
Jun 11, 2019
1 parent
d92f295
commit eb11691
Showing
2 changed files
with
87 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use strict"; | ||
describe('Push', () => { | ||
let _golbal, Push; | ||
beforeAll(function() { | ||
_golbal = this; | ||
Push = _golbal.rongSDK.Push; | ||
}); | ||
const config = require('../lib/push/api.json'); | ||
|
||
describe('push', () => { | ||
let conf = config.push; | ||
let response = conf.response; | ||
let success = response.success.code; | ||
|
||
it('Success', () => { | ||
let pushContent = _golbal.pushContent; | ||
return Push.push(pushContent).then(result => { | ||
expect(result.code).toEqual(Number(success)); | ||
}); | ||
}); | ||
|
||
it('Fail', () => { | ||
return Push.push({}).catch(error => { | ||
expect(error).not.toBeUndefined(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('message', () => { | ||
let conf = config.message; | ||
let response = conf.response; | ||
let success = response.success.code; | ||
|
||
it('Success', () => { | ||
let pushMessage = _golbal.pushMessage; | ||
return Push.message(pushMessage).then(result => { | ||
expect(result.code).toEqual(Number(success)); | ||
}); | ||
}); | ||
|
||
it('Fail', () => { | ||
return Push.message({}).catch(error => { | ||
expect(error).not.toBeUndefined(); | ||
}); | ||
}); | ||
}); | ||
}); |