Skip to content

Commit

Permalink
test: ut for china domains
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Mar 20, 2024
1 parent a156614 commit 684e9e2
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions test/unit/util/sfdcUrlTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ describe('util/sfdcUrl', () => {

describe('toLightningdomain', () => {
describe('official test cases from domains team', () => {
describe('SFDC (non-propagated)', () => {
it('SFDC (non-propagated)', () => {
expect(new SfdcUrl('https://na44.salesforce.com').toLightningDomain()).to.equal(
'https://na44.lightning.force.com'
);
});

describe('SFDC/DB/CLOUDFORCE (legacy instanceless domains) ', () => {
it('SFDC/DB/CLOUDFORCE (legacy instanceless domains) ', () => {
expect(new SfdcUrl('https://org62.my.salesforce.com').toLightningDomain()).to.equal(
'https://org62.lightning.force.com'
);
Expand All @@ -53,23 +53,23 @@ describe('util/sfdcUrl', () => {
'https://org62--sbox1.lightning.force.com'
);
});
describe('alternative domains with weird hyphen pattern', () => {
it('alternative domains with weird hyphen pattern', () => {
expect(new SfdcUrl('https://org62.my-salesforce.com').toLightningDomain()).to.equal(
'https://org62.my-lightning.com'
);
expect(new SfdcUrl('https://sbox1.org62.sandbox.my-salesforce.com').toLightningDomain()).to.equal(
'https://sbox1.org62.sandbox.my-lightning.com'
);
});
describe('mil', () => {
it('mil', () => {
expect(new SfdcUrl('https://org62.my.salesforce.mil').toLightningDomain()).to.equal(
'https://org62.lightning.crmforce.mil'
);
expect(new SfdcUrl('https://org62--sbox1.sandbox.my.salesforce.mil').toLightningDomain()).to.equal(
'https://org62--sbox1.sandbox.lightning.crmforce.mil'
);
});
describe('enhanced domains', () => {
it('enhanced domains', () => {
expect(new SfdcUrl('https://org62.my.salesforce.com').toLightningDomain()).to.equal(
'https://org62.lightning.force.com'
);
Expand Down Expand Up @@ -122,6 +122,18 @@ describe('util/sfdcUrl', () => {
);
});
});
describe('china', () => {
it('prod', () => {
expect(new SfdcUrl('https://foo.my.sfcrmproducts.cn').toLightningDomain()).to.equal(
'https://foo.lightning.sfcrmapps.cn'
);
});
it('sbox', () => {
expect(new SfdcUrl('https://foo--sbox1.sandbox.my.sfcrmproducts.cn').toLightningDomain()).to.equal(
'https://foo--sbox1.sandbox.lightning.sfcrmapps.cn'
);
});
});
});

describe('isSalesforceDomain', () => {
Expand All @@ -139,6 +151,16 @@ describe('util/sfdcUrl', () => {
const url = new SfdcUrl('https://developer.salesforce.com');
expect(url.isSalesforceDomain()).to.be.true;
});

it('china', () => {
const url = new SfdcUrl('https://foo.my.sfcrmproducts.cn');
expect(url.isSalesforceDomain()).to.be.true;
});

it('china with .com returns value', () => {
const url = new SfdcUrl('https://foo.my.sfcrmproducts.com');
expect(url.isSalesforceDomain()).to.be.false;
});
});

describe('internal domains', () => {
Expand Down Expand Up @@ -309,6 +331,19 @@ describe('util/sfdcUrl', () => {
const isLightningDomain = url.isLightningDomain();
expect(isLightningDomain).to.be.false;
});

it('mil', () => {
expect(new SfdcUrl('https://foo.lightning.crmforce.mil').isLightningDomain()).to.be.true;
});
it('mil but not lightning', () => {
expect(new SfdcUrl('https://foo.my.salesforce.mil').isLightningDomain()).to.be.false;
});
it('china', () => {
expect(new SfdcUrl('https://foo.lightning.sfcrmapps.cn').isLightningDomain()).to.be.true;
});
it('china but not lightning', () => {
expect(new SfdcUrl('https://foo.my.sfcrmproducts.cn').isLightningDomain()).to.be.false;
});
});

describe('Salesforce standard urls', () => {
Expand Down

0 comments on commit 684e9e2

Please sign in to comment.