Skip to content

Commit

Permalink
SALTO-4870 always default domain to zendesk.com (#4960)
Browse files Browse the repository at this point in the history
  • Loading branch information
netama authored Oct 10, 2023
1 parent 73eecd5 commit 6faa3a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/zendesk-adapter/src/client/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import _ from 'lodash'
import axios from 'axios'
import axiosRetry from 'axios-retry'
import { AccountInfo } from '@salto-io/adapter-api'
Expand Down Expand Up @@ -40,7 +41,7 @@ const EXPECTED_VALID_ACCOUNT_RES = Joi.object({
}).unknown(true).required()

export const instanceUrl = (subdomain: string, domain?: string): string => (
domain === undefined ? `https://${subdomain}.zendesk.com` : `https://${subdomain}.${domain}`
_.isEmpty(domain) ? `https://${subdomain}.zendesk.com` : `https://${subdomain}.${domain}`
)
const baseUrl = instanceUrl
// A URL for resource files
Expand Down
12 changes: 12 additions & 0 deletions packages/zendesk-adapter/test/adapter_creator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ describe('adapter creator', () => {
port: 8080,
clientId: 'client',
})).toEqual('https://abc.zendesk1.org/oauth/authorizations/new?response_type=token&redirect_uri=http://localhost:8080&client_id=client&scope=read%20write')
expect(createUrlFromUserInput({
subdomain: 'abc',
domain: '',
port: 8080,
clientId: 'client',
})).toEqual('https://abc.zendesk.com/oauth/authorizations/new?response_type=token&redirect_uri=http://localhost:8080&client_id=client&scope=read%20write')
expect(createUrlFromUserInput({
subdomain: 'abc',
domain: undefined,
port: 8080,
clientId: 'client',
})).toEqual('https://abc.zendesk.com/oauth/authorizations/new?response_type=token&redirect_uri=http://localhost:8080&client_id=client&scope=read%20write')
})

it('should validate credentials using createConnection', async () => {
Expand Down

0 comments on commit 6faa3a9

Please sign in to comment.