Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
chore: rename command
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 committed Aug 19, 2023
1 parent 65f98d6 commit db4c4cb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"command": "env:api",
"command": "org:api",
"plugin": "@cristiand391/sf-plugin-api",
"flags": ["body", "header", "include", "method", "target-org"],
"alias": [],
Expand Down
6 changes: 3 additions & 3 deletions src/commands/env/api.ts → src/commands/org/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const messages = Messages.loadMessages(
'env.api',
);

export default class EnvApi extends SfCommand<void> {
export class OrgApi extends SfCommand<void> {
public static readonly summary = messages.getMessage('summary');
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessages('examples');
Expand Down Expand Up @@ -92,7 +92,7 @@ export default class EnvApi extends SfCommand<void> {
}

public async run(): Promise<void> {
const { flags, args } = await this.parse(EnvApi);
const { flags, args } = await this.parse(OrgApi);

const org = flags['target-org'];

Expand All @@ -111,7 +111,7 @@ export default class EnvApi extends SfCommand<void> {
// eslint-disable-next-line sf-plugin/get-connection-with-version
org.getConnection().getConnectionOptions().accessToken
}`,
...(flags.header ? EnvApi.getHeaders(flags.header) : {}),
...(flags.header ? OrgApi.getHeaders(flags.header) : {}),
},
body:
flags.method === 'GET'
Expand Down
10 changes: 5 additions & 5 deletions test/commands/env/api.test.ts → test/commands/org/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { SfError } from '@salesforce/core';
import { expect } from 'chai';
import stripAnsi = require('strip-ansi');
import { stdout } from '@oclif/core';
import EnvApi from '../../../src/commands/env/api';
import { OrgApi }from '../../../src/commands/org/api';

describe('env api', () => {
describe('org api', () => {
const $$ = new TestContext();
const testOrg = new MockTestOrgData('1234', {
username: '[email protected]',
Expand Down Expand Up @@ -35,7 +35,7 @@ describe('env api', () => {
.get('/services/data/v56.0/limits')
.reply(200, orgLimitsResponse);

await EnvApi.run([
await OrgApi.run([
'services/data/v56.0/limits',
'--target-org',
'[email protected]',
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('env api', () => {
.get('/services/data')
.reply(200, xmlRes);

await EnvApi.run([
await OrgApi.run([
'services/data',
'--header',
'Accept: application/xml',
Expand All @@ -79,7 +79,7 @@ describe('env api', () => {

it('should validate HTTP headers are in a "key:value" format', async () => {
try {
await EnvApi.run([
await OrgApi.run([
'services/data',
'--header',
'Accept application/xml',
Expand Down

0 comments on commit db4c4cb

Please sign in to comment.