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

Rename generate-vdm command to generate-odata-client #42

Merged
merged 9 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { Command } from '@oclif/command';
import { generate, generatorOptionsCli as generatorOptionsSDK } from '@sap/cloud-sdk-generator';
import { BoolArgType, generatorOptionCli, StringArgType, toBooleanFlag, toGeneratorSDK, toStringFlag } from '../utils/generate-vdm-util';

export default class GenerateVdm extends Command {
export default class GenerateODataClient extends Command {
static description =
'Generates a virtual data model (VDM) from a edmx service file definition. For SAP solutions, you can find these definitions at https://api.sap.com/.';
'Generates a OData client from a edmx service file definition. For SAP solutions, you can find these definitions at https://api.sap.com/.';

static examples = [
'$ sap-cloud-sdk generate-vdm -i directoryWithEdmxFiles -o outputDirectory --forceOverwrite',
Expand Down Expand Up @@ -39,7 +39,7 @@ export default class GenerateVdm extends Command {
};

async run() {
const { flags } = this.parse(GenerateVdm);
const { flags } = this.parse(GenerateODataClient);

await generate(toGeneratorSDK(flags));
}
Expand Down
10 changes: 5 additions & 5 deletions test/generate-vdm.spec.ts → test/generate-odata-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { GeneratorOptions as GeneratorOptionsSDK, generatorOptionsCli as generatorOptionsSDK } from '@sap/cloud-sdk-generator';
import * as fs from 'fs-extra';
import * as path from 'path';
import GenerateVdm from '../src/commands/generate-vdm';
import GenerateODataClient from '../src/commands/generate-odata-client';
import * as generateVdmUtil from '../src/utils/generate-vdm-util';

const spyToGeneratorSDK = jest.spyOn(generateVdmUtil, 'toGeneratorSDK');
Expand All @@ -23,7 +23,7 @@ describe('generate-vdm', () => {

it('should fail if the mandatory parameters are not there', async () => {
try {
await GenerateVdm.run([]);
await GenerateODataClient.run([]);
} catch (e) {
expect(e.message).toContain('-i, --inputDir INPUTDIR');
}
Expand All @@ -33,7 +33,7 @@ describe('generate-vdm', () => {
const expected = getParsedInputWithAllBooleanFlagsFalse();
delete expected.projectDir;
try {
await GenerateVdm.run([...getCliInputWithAllBooleanFlagsFalse(), '--projectDir', getProjectDir()]);
await GenerateODataClient.run([...getCliInputWithAllBooleanFlagsFalse(), '--projectDir', getProjectDir()]);
} catch (e) {
expect(e.message).toContain('ENOENT: no such file or directory');
expect(spyToGeneratorSDK).toHaveReturnedWith(expected);
Expand All @@ -46,7 +46,7 @@ describe('generate-vdm', () => {
const expected = getDefault(getProjectDir());

try {
await GenerateVdm.run(['-i', 'input', '-o', 'output', '--projectDir', getProjectDir()]);
await GenerateODataClient.run(['-i', 'input', '-o', 'output', '--projectDir', getProjectDir()]);
} catch (e) {
expect(e.message).toContain('ENOENT: no such file or directory');
expect(spyToGeneratorSDK).toHaveReturnedWith(expected);
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('generate-vdm', () => {
const argsExpected = getInputAndExpected(key as keyof GeneratorOptionsSDK);
if (argsExpected) {
try {
await GenerateVdm.run(argsExpected.args);
await GenerateODataClient.run(argsExpected.args);
} catch (e) {
expect(e.message).toContain('ENOENT: no such file or directory');
expect(spyToGeneratorSDK).toHaveReturnedWith(argsExpected.expected);
Expand Down
Loading