Skip to content

Commit 7ad363a

Browse files
committed
fix: update unit tests for org open
1 parent 981e694 commit 7ad363a

File tree

1 file changed

+20
-28
lines changed

1 file changed

+20
-28
lines changed

test/unit/org/open.test.ts

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -139,37 +139,29 @@ describe('org:open', () => {
139139
});
140140

141141
it('--source-file when flexipage query errors', async () => {
142-
try {
143-
await OrgOpenCommand.run([
144-
'--json',
145-
'--targetusername',
146-
testOrg.username,
147-
'--urlonly',
148-
'--source-file',
149-
flexipagesDir,
150-
]);
151-
expect.fail('should have thrown an error');
152-
} catch (e) {
153-
assert(e instanceof Error);
154-
expect(e.message).to.include(`Unable to generate metadata URL for file: ${flexipagesDir}`);
155-
}
142+
const response = await OrgOpenCommand.run([
143+
'--json',
144+
'--targetusername',
145+
testOrg.username,
146+
'--urlonly',
147+
'--source-file',
148+
flexipagesDir,
149+
]);
150+
151+
expect(response.url).to.equal(expectedDefaultSingleUseUrl);
156152
});
157153

158154
it('--source-file to neither flexipage or apexpage', async () => {
159-
try {
160-
await OrgOpenCommand.run([
161-
'--json',
162-
'--targetusername',
163-
testOrg.username,
164-
'--urlonly',
165-
'--source-file',
166-
apexDir,
167-
]);
168-
expect.fail('should have thrown an error');
169-
} catch (e) {
170-
assert(e instanceof Error);
171-
expect(e.message).to.include(`Unable to generate metadata URL for file: ${apexDir}`);
172-
}
155+
const response = await OrgOpenCommand.run([
156+
'--json',
157+
'--targetusername',
158+
testOrg.username,
159+
'--urlonly',
160+
'--source-file',
161+
apexDir,
162+
]);
163+
164+
expect(response.url).to.equal(expectedDefaultSingleUseUrl);
173165
});
174166
});
175167

0 commit comments

Comments
 (0)