Skip to content

Commit

Permalink
Merge pull request #200 from ringcentral/RemoveAcceptJsonHeader
Browse files Browse the repository at this point in the history
fixed test
  • Loading branch information
DaKingKong committed Jan 5, 2023
2 parents dd55d0a + c79b2ed commit 25223f1
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions sdk/src/SDK-spec.ts
@@ -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

0 comments on commit 25223f1

Please sign in to comment.