Skip to content

Commit

Permalink
test: add domain to authinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jan 13, 2021
1 parent e1dc134 commit 794c99b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/unit/connectionTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Connection', () => {
initializeStub = $$.SANDBOX.stub(jsforce.Connection.prototype, 'initialize').returns();
requestMock = $$.SANDBOX.stub(jsforce.Connection.prototype, 'request')
.onFirstCall()
.returns(Promise.resolve([{ version: '42.0' }]));
.resolves([{ version: '42.0' }]);
});

it('create() should throw on DNS errors', async () => {
Expand Down Expand Up @@ -242,10 +242,11 @@ describe('Connection', () => {
id: '123',
name: 'testName',
};
requestMock.returns(Promise.resolve({ totalSize: 1, records: [mockSingleRecord] }));
const soql = 'TEST_SOQL';
requestMock.onSecondCall().resolves({ totalSize: 1, records: [mockSingleRecord] });

const conn = await Connection.create({ authInfo: testAuthInfoWithDomain as AuthInfo });

const conn = await Connection.create({ authInfo: testAuthInfo as AuthInfo });
const queryResult = await conn.singleRecordQuery(soql);
expect(queryResult).to.deep.equal({
...mockSingleRecord,
Expand All @@ -254,7 +255,7 @@ describe('Connection', () => {

it('singleRecordQuery throws on no-records', async () => {
requestMock.returns(Promise.resolve({ totalSize: 0, records: [] }));
const conn = await Connection.create({ authInfo: testAuthInfo as AuthInfo });
const conn = await Connection.create({ authInfo: testAuthInfoWithDomain as AuthInfo });

try {
await conn.singleRecordQuery('TEST_SOQL');
Expand All @@ -266,7 +267,7 @@ describe('Connection', () => {

it('singleRecordQuery throws on multiple records', async () => {
requestMock.returns(Promise.resolve({ totalSize: 2, records: [{ id: 1 }, { id: 2 }] }));
const conn = await Connection.create({ authInfo: testAuthInfo as AuthInfo });
const conn = await Connection.create({ authInfo: testAuthInfoWithDomain as AuthInfo });

try {
await conn.singleRecordQuery('TEST_SOQL');
Expand All @@ -278,7 +279,7 @@ describe('Connection', () => {

it('singleRecordQuery throws on multiple records with options', async () => {
requestMock.returns(Promise.resolve({ totalSize: 2, records: [{ id: 1 }, { id: 2 }] }));
const conn = await Connection.create({ authInfo: testAuthInfo as AuthInfo });
const conn = await Connection.create({ authInfo: testAuthInfoWithDomain as AuthInfo });

try {
await conn.singleRecordQuery('TEST_SOQL', { returnChoicesOnMultiple: true, choiceField: 'id' });
Expand All @@ -297,7 +298,7 @@ describe('Connection', () => {
requestMock.returns(Promise.resolve({ totalSize: 1, records: [mockSingleRecord] }));
const soql = 'TEST_SOQL';

const conn = await Connection.create({ authInfo: testAuthInfo as AuthInfo });
const conn = await Connection.create({ authInfo: testAuthInfoWithDomain as AuthInfo });
const toolingQuerySpy = $$.SANDBOX.spy(conn.tooling, 'query');
const queryResults = await conn.singleRecordQuery(soql, { tooling: true });
expect(queryResults).to.deep.equal({
Expand Down

0 comments on commit 794c99b

Please sign in to comment.