Skip to content

Commit 19ee2f0

Browse files
committed
fix: add unit test
1 parent f5af252 commit 19ee2f0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/commands/delete/source.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ describe('project delete source', () => {
117117
let lifecycleEmitStub: sinon.SinonStub;
118118
let resolveProjectConfigStub: sinon.SinonStub;
119119
let rmStub: sinon.SinonStub;
120+
let compSetFromSourceStub: sinon.SinonStub;
120121

121122
class TestDelete extends Source {
122123
public async runIt() {
@@ -167,6 +168,10 @@ describe('project delete source', () => {
167168
});
168169
const lifecycle = Lifecycle.getInstance();
169170
lifecycleEmitStub = $$.SANDBOX.stub(lifecycle, 'emit');
171+
172+
compSetFromSourceStub = stubMethod($$.SANDBOX, ComponentSet, 'fromSource').returns({
173+
toArray: () => [new SourceComponent(exampleSourceComponent)],
174+
});
170175
});
171176

172177
afterEach(() => {
@@ -228,6 +233,23 @@ describe('project delete source', () => {
228233
ensureHookArgs();
229234
});
230235

236+
it('should pass along metadata and org for pseudo-type matching', async () => {
237+
const metadata = ['Agent:My_Agent'];
238+
await runDeleteCmd(['--metadata', metadata[0], '--json']);
239+
ensureCreateComponentSetArgs({
240+
metadata: {
241+
metadataEntries: metadata,
242+
directoryPaths: [defaultPackagePath],
243+
},
244+
org: {
245+
username: testOrg.username,
246+
exclude: [],
247+
},
248+
});
249+
ensureHookArgs();
250+
expect(compSetFromSourceStub.calledOnce).to.be.true;
251+
});
252+
231253
it('should pass along apiversion', async () => {
232254
const metadata = ['ApexClass:MyClass'];
233255

0 commit comments

Comments
 (0)