Skip to content

Commit 372d7a1

Browse files
authored
fix: regex lightning is surrounded by period (#732)
1 parent d29acc8 commit 372d7a1

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.mocharc.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"require": "ts-node/register,source-map-support/register",
33
"watch-extensions": "ts",
4+
"watch-files": ["src", "test"],
45
"recursive": true,
56
"reporter": "spec",
67
"timeout": 10000

src/common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class Common {
3535
}
3636

3737
const throwIfLightning = (urlString?: string): void => {
38-
if (urlString?.match(/lightning\..*force\.com/)) {
38+
if (urlString?.match(/\.lightning\..*force\.com/)) {
3939
throw new SfError(messages.getMessage('lightningInstanceUrl'), 'LightningDomain', [
4040
messages.getMessage('flags.instance-url.description'),
4141
]);

test/common.test.ts

+6
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ describe('common unit tests', () => {
9191
}
9292
});
9393

94+
it('should allow a domain containing lightning in its login URL', async () => {
95+
await projectSetup($$, true);
96+
const loginUrl = await Common.resolveLoginUrl('https://mycompany-lightning.my.salesforce.com');
97+
expect(loginUrl).equals('https://mycompany-lightning.my.salesforce.com');
98+
});
99+
94100
it('should throw on internal lightning login URL passed in to resolveLoginUrl()', async () => {
95101
await projectSetup($$, true);
96102
try {

0 commit comments

Comments
 (0)