Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: regex lightning is surrounded by period #732

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"require": "ts-node/register,source-map-support/register",
"watch-extensions": "ts",
"watch-files": ["src", "test"],
"recursive": true,
"reporter": "spec",
"timeout": 10000
Expand Down
2 changes: 1 addition & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class Common {
}

const throwIfLightning = (urlString?: string): void => {
if (urlString?.match(/lightning\..*force\.com/)) {
if (urlString?.match(/\.lightning\..*force\.com/)) {
throw new SfError(messages.getMessage('lightningInstanceUrl'), 'LightningDomain', [
messages.getMessage('flags.instance-url.description'),
]);
Expand Down
6 changes: 6 additions & 0 deletions test/common.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ describe('common unit tests', () => {
}
});

it('should allow a domain containing lightning in its login URL', async () => {
await projectSetup($$, true);
const loginUrl = await Common.resolveLoginUrl('https://mycompany-lightning.my.salesforce.com');
expect(loginUrl).equals('https://mycompany-lightning.my.salesforce.com');
});

it('should throw on internal lightning login URL passed in to resolveLoginUrl()', async () => {
await projectSetup($$, true);
try {
Expand Down