Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed test #200

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions sdk/src/SDK-spec.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
import {expect, SDK, spy} from './test/test';

describe('RingCentral.SDK', () => {
const test = async (suite, server) => {
suite.timeout(20000); // Per SLA should be 3 seconds

it('connects to sandbox', async function theTest() {
this.timeout(20000);
const server = SDK.server.sandbox;
const sdk = new SDK({
server,
clientId: '',
clientSecret: '',
});

const res = await sdk.platform().get('/restapi/v1.0', null, {skipAuthCheck: true});
// sandbox's /restapi/v1.0 throws a weird error, but /restapi/v1.0/status works fine
const res = await sdk.platform().get('/restapi/v1.0/status', null, {skipAuthCheck: true});

await sdk.cache().clean();

expect((await res.json()).uri).to.equal(`${server}/restapi/v1.0`);
};

it('connects to sandbox', async function theTest() {
return test(this, SDK.server.sandbox);
expect(res.status).to.equal(200);
});

it('connects to production', async function theTest() {
return test(this, SDK.server.production);
this.timeout(20000);
const server = SDK.server.production;
const sdk = new SDK({
server,
clientId: '',
clientSecret: '',
});

// production's /restapi/v1.0/status triggers service overloaded very easily, but /restapi/v1.0 works fine
const res = await sdk.platform().get('/restapi/v1.0', null, {skipAuthCheck: true});

await sdk.cache().clean();

expect(res.status).to.equal(200);
});

it('sets rate limit', async function rateLimitTest() {
Expand Down