-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mp): add mp get phone number function
- Loading branch information
jay
committed
Jul 7, 2022
1 parent
c6c2e77
commit f003582
Showing
4 changed files
with
91 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { MiniProgramService } from './miniprogram.service'; | ||
|
||
describe('mini program service test', () => { | ||
|
||
let service: MiniProgramService; | ||
|
||
beforeAll(() => { | ||
service = new MiniProgramService({ | ||
appId: 'your/mini/app/id', | ||
secret: 'your/mini/app/secret', | ||
}); | ||
}); | ||
|
||
it('Should not got a phone number use incorrect token', async () => { | ||
const accessToken = 'INCORRECT_TOKEN'; | ||
const code = 'INCORRECT_CODE'; | ||
try { | ||
const ret = await service.getPhoneNumber(code, accessToken); | ||
// { errcode: 40001, errmsg: 'invalid credential, access_token is invalid or not latest rid: 62c66213-76542f8c-06b14179'} | ||
expect(ret.data.errcode).toStrictEqual(40001); | ||
} catch (error) { | ||
expect(error).toBeUndefined(); | ||
} | ||
}); | ||
|
||
}); |
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