Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move on 'v3' format #58

Merged
merged 5 commits into from
Mar 1, 2021
Merged

feat: move on 'v3' format #58

merged 5 commits into from
Mar 1, 2021

Conversation

alex-gilin
Copy link
Contributor

No description provided.

await cfGetServiceInstances({ 'filters': [{ key: eFilters.service_plan_guid, value: _.join(await getServicePlansGuidList(serviceTypes)), op: eOperation.IN }] }),
(service => { return _.includes(serviceTypes, service.serviceName); })
);
const services = await cfGetServices(await padQuerySpace({ 'filters': [{ key: eFilters.names, value: _.join(_.map(serviceTypes, encodeURIComponent)) }] }));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not clear when all in one line. I would divide it and maybe add comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagrees with you - declarative style more clear and compact -> personal preference.

src/messages.ts Outdated
export const messages = {
space_not_set: "Space not set",
service_creation_started: "",
service_creation_started: "Service creation started, waiting for 'Ready' state.",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it visible for a user? Is reviewed by Paola?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ask her..

src/utils.ts Outdated
import * as _ from "lodash";
import * as os from "os";
import * as fsextra from "fs-extra";
import { IServiceQuery, CF_PAGE_SIZE } from "./types";
import path = require("path");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will "import * as path from 'path';" more consistent here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. done

const configJson = parse(await fsextra.readFile(cfGetConfigFilePath(), "utf8"));
return _.get(configJson, `${field}`);
} catch (error) {
// empty or non existing file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No action on error? What will be returned? Does the calling function expect it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. it is by design.

src/cli.ts Outdated Show resolved Hide resolved
src/cli.ts Outdated
@@ -55,6 +49,7 @@ export class Cli {
private static readonly CF_CMD = "cf";

private static cliResultOnExit(stdout: string, resolve: (value?: CliResult | PromiseLike<CliResult>) => void, stderr: string, code: number) {
const getValueExceptEol = (value: string) => value === '\n' ? '' : value;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line (see comment on line 79)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/messages.ts Outdated Show resolved Hide resolved
@@ -50,29 +45,29 @@ describe("cf-local-a unit tests", () => {
exitCode: 1
};

it("stdout is not empty, authentication is OK", async () => {
it("success:: stdout is not empty, authentication is OK", async () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why '::' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not ?see below.

cliResult.stdout = "test modified (current test";
cliResult.error = "";
cliMock.expects("execute").withExactArgs(["targets"], undefined, undefined).resolves(cliResult);
const result = await cfLocal.cfGetTargets();
expect(result).to.be.deep.equal([{ label: "test modified", isCurrent: true, isDirty: true }]);
});

it("no '(current' in parentthesisPos", async () => {
it("ok:: no '(current' in parentthesisPos", async () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this prefix "ok::" used for ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test description combined according to the next pattern : 'result':: 'description'-'optional params', where
'result' - 'ok' | 'fail' | 'exception'
'description' - free text explains test purpose/case
'optional params' - optional to different test cases
In general, I intend to use this pattern in all unit test for giving more flexible options to filter/search different test units.

@alex-gilin alex-gilin merged commit 846bd87 into master Mar 1, 2021
@alex-gilin alex-gilin deleted the v3 branch March 1, 2021 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants