fix: accept access token response
This commit is contained in:
@@ -178,6 +178,23 @@ async function run() {
|
||||
);
|
||||
assert.strictEqual(missingTokenStore.getItem('token-key'), null);
|
||||
|
||||
const snakeTokenStore = createStore();
|
||||
const snakeTokenClient = GenealogyApi.createClient({
|
||||
baseUrl: 'http://182.61.18.23:8080',
|
||||
clientId: 'client-x',
|
||||
tenantId: 'tenant-x',
|
||||
tokenKey: 'token-key',
|
||||
tokenStore: snakeTokenStore,
|
||||
axiosInstance: {
|
||||
request: async () => ({
|
||||
status: 200,
|
||||
data: { code: 200, data: { access_token: 'snake-token' } }
|
||||
})
|
||||
}
|
||||
});
|
||||
await snakeTokenClient.login({ phone: '13800000000', password: 'md5' });
|
||||
assert.strictEqual(snakeTokenStore.getItem('token-key'), 'snake-token');
|
||||
|
||||
store.setItem('token-key', 'logout-token');
|
||||
await client.logout();
|
||||
assert.strictEqual(calls[9].url, '/genealogy/pc/auth/logout');
|
||||
|
||||
Reference in New Issue
Block a user