Skip to content

Commit

Permalink
chore(testing): Modify org.test.ts
Browse files Browse the repository at this point in the history
Start explorations of automated testing by bringing the boilerplate test
code up to the most recent version from sfdx plugins:generate

Related to: #133
  • Loading branch information
VivekMChawla committed Feb 23, 2019
1 parent 3c35c24 commit a63a679
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/commands/hello/org.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { expect, test } from '@salesforce/command/dist/test';
import { expect, test } from '@salesforce/command/lib/test';
import { ensureJsonMap, ensureString } from '@salesforce/ts-types';

describe('hello:org', () => {
test
.withOrg({ username: 'test@org.com' }, true)
.withConnectionRequest(function() {
return Promise.resolve({ records: [ { Name: 'Super Awesome Org', TrialExpirationDate: '2018-03-20T23:24:11.000+0000'}]});
.withConnectionRequest(request => {
const requestMap = ensureJsonMap(request);
if (ensureString(requestMap.url).match(/Organization/)) {
return Promise.resolve({ records: [ { Name: 'Super Awesome Org', TrialExpirationDate: '2018-03-20T23:24:11.000+0000'}] });
}
return Promise.resolve({ records: [] });
})
.stdout()
.command(['hello:org', '--targetusername', 'test@org.com'])
.it('runs hello:org --targetusername test@org.com', (ctx) => {
.it('runs hello:org --targetusername test@org.com', ctx => {
expect(ctx.stdout).to.contain('Hello world! This is org: Super Awesome Org and I will be around until Tue Mar 20 2018!');
});
});

0 comments on commit a63a679

Please sign in to comment.