forked from alibaba/funcraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.test.js
37 lines (28 loc) · 905 Bytes
/
client.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
const expect = require('expect.js');
const { setProcess } = require('./test-utils');
const client = require('../lib/client');
describe('without local ~/.fcli/config.yaml', () => {
let restoreProcess;
beforeEach(() => {
restoreProcess = setProcess({
ACCOUNT_ID: 'testAccountId',
ACCESS_KEY_ID: 'testKeyId',
ACCESS_KEY_SECRET: 'testKeySecret',
FC_ENDPOINT: 'test fc endpoint',
REGION: 'cn-beijing'
});
});
afterEach(() => {
restoreProcess();
});
it('with FC_ENDPOINT', async () => {
const fcClient = await client.getFcClient();
expect(fcClient.endpoint).to.eql('test fc endpoint');
});
it('without FC_ENDPOINT', async () => {
delete process.env.FC_ENDPOINT;
const fcClient = await client.getFcClient();
expect(fcClient.endpoint).to.eql('https://testAccountId.cn-beijing.fc.aliyuncs.com');
});
});