This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
199a1fa
commit 9c1c08d
Showing
1 changed file
with
25 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,13 @@ describe('org api', () => { | |
|
||
let stdoutSpy: sinon.SinonSpy; | ||
|
||
const orgLimitsResponse = { | ||
ActiveScratchOrgs: { | ||
Max: 200, | ||
Remaining: 199, | ||
}, | ||
}; | ||
|
||
beforeEach(async () => { | ||
await $$.stubAuths(testOrg); | ||
stdoutSpy = $$.SANDBOX.stub(process.stdout, 'write'); | ||
|
@@ -26,13 +33,6 @@ describe('org api', () => { | |
}); | ||
|
||
it('should request org limits and default to "GET" HTTP method', async () => { | ||
const orgLimitsResponse = { | ||
ActiveScratchOrgs: { | ||
Max: 200, | ||
Remaining: 199, | ||
}, | ||
}; | ||
|
||
nock(testOrg.instanceUrl) | ||
.get('/services/data/v56.0/limits') | ||
.reply(200, orgLimitsResponse); | ||
|
@@ -101,4 +101,22 @@ describe('org api', () => { | |
); | ||
} | ||
}); | ||
|
||
it('should not follow redirects', async () => { | ||
nock(testOrg.instanceUrl) | ||
.get('/services/data/v56.0/limites') | ||
.reply(301, orgLimitsResponse, { | ||
location: `${testOrg.instanceUrl}/services/data/v56.0/limits`, | ||
}); | ||
|
||
await OrgApi.run([ | ||
'services/data/v56.0/limites', | ||
'--target-org', | ||
'[email protected]', | ||
]); | ||
|
||
const output = stripAnsi(stdoutSpy.args.flat().join('')); | ||
|
||
expect(JSON.parse(output)).to.deep.equal(orgLimitsResponse); | ||
}); | ||
}); |