Skip to content

Commit dc22c49

Browse files
lint fix
1 parent f4e212c commit dc22c49

File tree

2 files changed

+188
-189
lines changed

2 files changed

+188
-189
lines changed

test/integration/cis/range-applications.v1.test.js

Lines changed: 187 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -13,191 +13,190 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
'use strict';
17-
18-
const RangeApplicationsV1 = require('../../../dist/cis/rangeapplicationsv1/v1');
19-
const { IamAuthenticator } = require('ibm-cloud-sdk-core');
20-
const authHelper = require('../../resources/auth-helper.js');
21-
const ZonesV1 = require('../../../dist/cis/zonesv1/v1');
22-
23-
const timeout = 120000; // two minutes
24-
25-
// Location of our config file.
26-
const configFile = 'cis.env';
27-
28-
// Use authHelper to skip tests if our configFile is not available.
29-
const describe = authHelper.prepareTests(configFile);
30-
31-
// Retrieve the config file as an object.
32-
// We do this because we're going to directly use the
33-
// config properties, rather than let the SDK do it for us.
34-
const config = authHelper.loadConfig();
35-
36-
describe('RangeApplicationsV1', () => {
37-
jest.setTimeout(timeout);
38-
39-
// Initialize the service client.
40-
const options = {
41-
authenticator: new IamAuthenticator({
42-
apikey: config.CIS_SERVICES_APIKEY,
43-
url: config.CIS_SERVICES_AUTH_URL,
44-
}),
45-
crn: config.CIS_SERVICES_CRN,
46-
serviceUrl: config.CIS_SERVICES_URL,
47-
version: config.CIS_SERVICES_API_VERSION,
48-
zoneIdentifier: config.CIS_SERVICES_ZONE_ID,
49-
};
50-
51-
let rangeApplicationsV1;
52-
let zonesV1;
53-
let rangeAppCreated;
54-
55-
test('should successfully complete initialization', done => {
56-
// Initialize the service client.
57-
rangeApplicationsV1 = RangeApplicationsV1.newInstance(options);
58-
expect(rangeApplicationsV1).not.toBeNull();
59-
60-
zonesV1 = ZonesV1.newInstance(options);
61-
expect(zonesV1).not.toBeNull();
62-
done();
63-
});
64-
65-
test('should successfully create the range application', async done => {
66-
try {
67-
const params = {
68-
protocol: 'tcp/35',
69-
dns: { type: 'CNAME', name: 'ab.' + config.DOMAIN_NAME },
70-
originDirect: ['tcp://2.5.6.7:35'],
71-
proxyProtocol: 'off',
72-
ipFirewall: false,
73-
tls: 'off',
74-
trafficType: 'direct',
75-
edgeIps: { connectivity: 'all', type: 'dynamic' },
76-
};
77-
const response = await rangeApplicationsV1.createRangeApp(params);
78-
expect(response).toBeDefined();
79-
expect(response.status).toEqual(200);
80-
81-
const result = response || {};
82-
expect(result).toBeDefined();
83-
84-
rangeAppCreated = result.result;
85-
if (rangeAppCreated) {
86-
expect(rangeAppCreated).toBeDefined();
87-
expect(rangeAppCreated.result.protocol).toEqual(params.protocol);
88-
expect(rangeAppCreated.result.dns).toEqual(params.dns);
89-
expect(rangeAppCreated.result.tls).toEqual(params.tls);
90-
expect(rangeAppCreated.result.origin_direct).toEqual(params.originDirect);
91-
expect(rangeAppCreated.result.proxy_protocol).toEqual(params.proxyProtocol);
92-
expect(rangeAppCreated.result.ip_firewall).toEqual(params.ipFirewall);
93-
}
94-
done();
95-
} catch (err) {
96-
done(err);
97-
}
98-
});
99-
100-
test('should successfully update the range application', async done => {
101-
try {
102-
const params = {
103-
appIdentifier: rangeAppCreated.result.id,
104-
protocol: 'tcp/35',
105-
dns: { type: 'CNAME', name: rangeAppCreated.result.dns.name },
106-
originDirect: ['tcp://2.5.6.7:32'],
107-
proxyProtocol: 'v1',
108-
ipFirewall: true,
109-
tls: 'flexible',
110-
trafficType: 'direct',
111-
};
112-
const response = await rangeApplicationsV1.updateRangeApp(params);
113-
expect(response).toBeDefined();
114-
expect(response.status).toEqual(200);
115-
116-
const result = response || {};
117-
expect(result).toBeDefined();
118-
rangeAppCreated = result.result;
119-
if (rangeAppCreated) {
120-
expect(rangeAppCreated).toBeDefined();
121-
expect(rangeAppCreated.result.protocol).toEqual(params.protocol);
122-
expect(rangeAppCreated.result.dns).toEqual(params.dns);
123-
expect(rangeAppCreated.result.tls).toEqual(params.tls);
124-
expect(rangeAppCreated.result.origin_direct).toEqual(params.originDirect);
125-
expect(rangeAppCreated.result.proxy_protocol).toEqual(params.proxyProtocol);
126-
expect(rangeAppCreated.result.ip_firewall).toEqual(params.ipFirewall);
127-
}
128-
done();
129-
} catch (err) {
130-
done(err);
131-
}
132-
});
133-
134-
test('should successfully fetch the range application', async done => {
135-
try {
136-
const params = {
137-
appIdentifier: rangeAppCreated.result.id,
138-
};
139-
const response = await rangeApplicationsV1.getRangeApp(params);
140-
expect(response).toBeDefined();
141-
expect(response.status).toEqual(200);
142-
143-
const result = response || {};
144-
expect(result).toBeDefined();
145-
const app = result.result;
146-
if (app) {
147-
expect(app).toBeDefined();
148-
expect(app.result.protocol).toEqual(rangeAppCreated.result.protocol);
149-
expect(app.result.dns).toEqual(rangeAppCreated.result.dns);
150-
expect(app.result.tls).toEqual(rangeAppCreated.result.tls);
151-
expect(app.result.origin_direct).toEqual(rangeAppCreated.result.origin_direct);
152-
expect(app.result.proxy_protocol).toEqual(rangeAppCreated.result.proxy_protocol);
153-
expect(app.result.ip_firewall).toEqual(rangeAppCreated.result.ip_firewall);
154-
}
155-
done();
156-
} catch (err) {
157-
done(err);
158-
}
159-
});
160-
161-
test('should successfully list the range application', async done => {
162-
try {
163-
const response = await rangeApplicationsV1.listRangeApps();
164-
expect(response).toBeDefined();
165-
expect(response.status).toEqual(200);
166-
167-
const { result } = response || {};
168-
expect(result).toBeDefined();
169-
170-
if (result.result && result.result.length > 0) {
171-
expect(result.result.length).toBeGreaterThan(0);
172-
expect(result.result[0].id).toBeDefined();
173-
expect(result.result[0].protocol).toBeDefined();
174-
}
175-
176-
done();
177-
} catch (err) {
178-
done(err);
179-
}
180-
});
181-
182-
test('should successfully delete the range application', async done => {
183-
try {
184-
const params = {
185-
appIdentifier: rangeAppCreated.result.id,
186-
};
187-
const response = await rangeApplicationsV1.deleteRangeApp(params);
188-
expect(response).toBeDefined();
189-
expect(response.status).toEqual(200);
190-
191-
const { result } = response || {};
192-
expect(result).toBeDefined();
193-
194-
if (result.result) {
195-
expect(result.result.id).toEqual(params.appIdentifier);
196-
}
197-
done();
198-
} catch (err) {
199-
done(err);
200-
}
201-
});
202-
});
203-
16+
'use strict';
17+
18+
const RangeApplicationsV1 = require('../../../dist/cis/rangeapplicationsv1/v1');
19+
const { IamAuthenticator } = require('ibm-cloud-sdk-core');
20+
const authHelper = require('../../resources/auth-helper.js');
21+
const ZonesV1 = require('../../../dist/cis/zonesv1/v1');
22+
23+
const timeout = 120000; // two minutes
24+
25+
// Location of our config file.
26+
const configFile = 'cis.env';
27+
28+
// Use authHelper to skip tests if our configFile is not available.
29+
const describe = authHelper.prepareTests(configFile);
30+
31+
// Retrieve the config file as an object.
32+
// We do this because we're going to directly use the
33+
// config properties, rather than let the SDK do it for us.
34+
const config = authHelper.loadConfig();
35+
36+
describe('RangeApplicationsV1', () => {
37+
jest.setTimeout(timeout);
38+
39+
// Initialize the service client.
40+
const options = {
41+
authenticator: new IamAuthenticator({
42+
apikey: config.CIS_SERVICES_APIKEY,
43+
url: config.CIS_SERVICES_AUTH_URL,
44+
}),
45+
crn: config.CIS_SERVICES_CRN,
46+
serviceUrl: config.CIS_SERVICES_URL,
47+
version: config.CIS_SERVICES_API_VERSION,
48+
zoneIdentifier: config.CIS_SERVICES_ZONE_ID,
49+
};
50+
51+
let rangeApplicationsV1;
52+
let zonesV1;
53+
let rangeAppCreated;
54+
55+
test('should successfully complete initialization', done => {
56+
// Initialize the service client.
57+
rangeApplicationsV1 = RangeApplicationsV1.newInstance(options);
58+
expect(rangeApplicationsV1).not.toBeNull();
59+
60+
zonesV1 = ZonesV1.newInstance(options);
61+
expect(zonesV1).not.toBeNull();
62+
done();
63+
});
64+
65+
test('should successfully create the range application', async done => {
66+
try {
67+
const params = {
68+
protocol: 'tcp/35',
69+
dns: { type: 'CNAME', name: 'ab.' + config.DOMAIN_NAME },
70+
originDirect: ['tcp://2.5.6.7:35'],
71+
proxyProtocol: 'off',
72+
ipFirewall: false,
73+
tls: 'off',
74+
trafficType: 'direct',
75+
edgeIps: { connectivity: 'all', type: 'dynamic' },
76+
};
77+
const response = await rangeApplicationsV1.createRangeApp(params);
78+
expect(response).toBeDefined();
79+
expect(response.status).toEqual(200);
80+
81+
const result = response || {};
82+
expect(result).toBeDefined();
83+
84+
rangeAppCreated = result.result;
85+
if (rangeAppCreated) {
86+
expect(rangeAppCreated).toBeDefined();
87+
expect(rangeAppCreated.result.protocol).toEqual(params.protocol);
88+
expect(rangeAppCreated.result.dns).toEqual(params.dns);
89+
expect(rangeAppCreated.result.tls).toEqual(params.tls);
90+
expect(rangeAppCreated.result.origin_direct).toEqual(params.originDirect);
91+
expect(rangeAppCreated.result.proxy_protocol).toEqual(params.proxyProtocol);
92+
expect(rangeAppCreated.result.ip_firewall).toEqual(params.ipFirewall);
93+
}
94+
done();
95+
} catch (err) {
96+
done(err);
97+
}
98+
});
99+
100+
test('should successfully update the range application', async done => {
101+
try {
102+
const params = {
103+
appIdentifier: rangeAppCreated.result.id,
104+
protocol: 'tcp/35',
105+
dns: { type: 'CNAME', name: rangeAppCreated.result.dns.name },
106+
originDirect: ['tcp://2.5.6.7:32'],
107+
proxyProtocol: 'v1',
108+
ipFirewall: true,
109+
tls: 'flexible',
110+
trafficType: 'direct',
111+
};
112+
const response = await rangeApplicationsV1.updateRangeApp(params);
113+
expect(response).toBeDefined();
114+
expect(response.status).toEqual(200);
115+
116+
const result = response || {};
117+
expect(result).toBeDefined();
118+
rangeAppCreated = result.result;
119+
if (rangeAppCreated) {
120+
expect(rangeAppCreated).toBeDefined();
121+
expect(rangeAppCreated.result.protocol).toEqual(params.protocol);
122+
expect(rangeAppCreated.result.dns).toEqual(params.dns);
123+
expect(rangeAppCreated.result.tls).toEqual(params.tls);
124+
expect(rangeAppCreated.result.origin_direct).toEqual(params.originDirect);
125+
expect(rangeAppCreated.result.proxy_protocol).toEqual(params.proxyProtocol);
126+
expect(rangeAppCreated.result.ip_firewall).toEqual(params.ipFirewall);
127+
}
128+
done();
129+
} catch (err) {
130+
done(err);
131+
}
132+
});
133+
134+
test('should successfully fetch the range application', async done => {
135+
try {
136+
const params = {
137+
appIdentifier: rangeAppCreated.result.id,
138+
};
139+
const response = await rangeApplicationsV1.getRangeApp(params);
140+
expect(response).toBeDefined();
141+
expect(response.status).toEqual(200);
142+
143+
const result = response || {};
144+
expect(result).toBeDefined();
145+
const app = result.result;
146+
if (app) {
147+
expect(app).toBeDefined();
148+
expect(app.result.protocol).toEqual(rangeAppCreated.result.protocol);
149+
expect(app.result.dns).toEqual(rangeAppCreated.result.dns);
150+
expect(app.result.tls).toEqual(rangeAppCreated.result.tls);
151+
expect(app.result.origin_direct).toEqual(rangeAppCreated.result.origin_direct);
152+
expect(app.result.proxy_protocol).toEqual(rangeAppCreated.result.proxy_protocol);
153+
expect(app.result.ip_firewall).toEqual(rangeAppCreated.result.ip_firewall);
154+
}
155+
done();
156+
} catch (err) {
157+
done(err);
158+
}
159+
});
160+
161+
test('should successfully list the range application', async done => {
162+
try {
163+
const response = await rangeApplicationsV1.listRangeApps();
164+
expect(response).toBeDefined();
165+
expect(response.status).toEqual(200);
166+
167+
const { result } = response || {};
168+
expect(result).toBeDefined();
169+
170+
if (result.result && result.result.length > 0) {
171+
expect(result.result.length).toBeGreaterThan(0);
172+
expect(result.result[0].id).toBeDefined();
173+
expect(result.result[0].protocol).toBeDefined();
174+
}
175+
176+
done();
177+
} catch (err) {
178+
done(err);
179+
}
180+
});
181+
182+
test('should successfully delete the range application', async done => {
183+
try {
184+
const params = {
185+
appIdentifier: rangeAppCreated.result.id,
186+
};
187+
const response = await rangeApplicationsV1.deleteRangeApp(params);
188+
expect(response).toBeDefined();
189+
expect(response.status).toEqual(200);
190+
191+
const { result } = response || {};
192+
expect(result).toBeDefined();
193+
194+
if (result.result) {
195+
expect(result.result.id).toEqual(params.appIdentifier);
196+
}
197+
done();
198+
} catch (err) {
199+
done(err);
200+
}
201+
});
202+
});

test/integration/cis/ssl-certificate-api.v1.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,4 +563,4 @@ describe.skip('SSL Certificate', () => {
563563
done();
564564
});
565565
});
566-
});
566+
});

0 commit comments

Comments
 (0)