Skip to content

Add lesson 2 with simple console calc#3

Merged
nickovchinnikov merged 5 commits intomasterfrom
nick/lesson2
Apr 6, 2020
Merged

Add lesson 2 with simple console calc#3
nickovchinnikov merged 5 commits intomasterfrom
nick/lesson2

Conversation

@nickovchinnikov
Copy link
Copy Markdown
Owner

No description provided.

@nickovchinnikov nickovchinnikov requested a review from vvscode April 5, 2020 21:53
@nickovchinnikov nickovchinnikov force-pushed the nick/lesson2 branch 2 times, most recently from 77a6a5d to 3b4cdc9 Compare April 6, 2020 06:58
@@ -0,0 +1,39 @@
import { firstPrioritiesCalc, secondPrioritiesCalc } from "./engine";

test("firstPrioritiesCalc: [1, * 32]", () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

просто комментарий - я привык к структуре describe(blockName) / it(testCase) - вроде это чаще с jest встречается

import { isNumber } from "./helpers";
import { mathOperators } from "./mathOperators";

export type ParsedLineType = Array<number | string>;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

А как использовать интерфейс, если у меня скалярный тип? Можно пример?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Откровенно говоря, для меня конструкция Array<number | string> более очевидна и предпочтительная vs (number | string)[]
В целом, можно сослаться и довериться твоему опыту, попробую использовать, спасибо!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

дело вкуса, я просто дал ссылку на тот стайлгайд, который внутри команды TS используется

любой вариант валиден, если он линтер проходит ))

mathOperatorsPriorities,
} from "./mathOperators";

const { FIRST, SECOND } = mathPriorities;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

в общем случае (когда может быть больше 2 приоритетов) это был бы масссив

Copy link
Copy Markdown
Collaborator

@vvscode vvscode left a comment

Choose a reason for hiding this comment

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

Лично мне не хватило подробной истории (чтобы по коммитам можно было проследить ход разработки)

@nickovchinnikov
Copy link
Copy Markdown
Owner Author

@vvscode все замечания поправил и подкинул в PR! Спасибо за проверку!

test("runner: 2 * 32", () => {
expect(runner("2 * 32")).toEqual(64);
});
it("runner: 2 * 32", () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

in case you have describe - no need to put that prefix runner: manually

when you run jest in verbose mode - it renders it as sublists

Copy link
Copy Markdown
Owner Author

@nickovchinnikov nickovchinnikov Apr 6, 2020

Choose a reason for hiding this comment

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

Very good catch, now everything according with the describe/it notation

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.

2 participants