Skip to content

fill-tank:master#321

Open
sonik-boom71 wants to merge 2 commits into
mate-academy:masterfrom
sonik-boom71:master
Open

fill-tank:master#321
sonik-boom71 wants to merge 2 commits into
mate-academy:masterfrom
sonik-boom71:master

Conversation

@sonik-boom71

Copy link
Copy Markdown

Добавлены unit-тесты для функции fillTank

Что сделано

  • Проверены базовые случаи заправки
  • Проверены граничные случаи (полный/пустой бак, цена 0)
  • Проверено округление результата (топливо — floor до 1 знака, цена — round до 2 знаков)
  • Проверен тип возвращаемого значения (undefined — функция мутирует объект)
  • Проверено ограничение по деньгам (заправка только до доступного остатка)
  • Проверен опциональный параметр amount
  • Проверены разные объёмы баков и цены

Как запустить тесты

npm test

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your test file demonstrates solid coverage for the fillTank function. All core requirements are properly tested including funding limitations, rounding behavior (fuel to 1 decimal, price to 2 decimals), the minimum 2-liter threshold, tank capacity constraints, and return value verification. The structure follows Jest best practices with well-organized describe blocks. Minor improvements to consider (not blocking): - The "should not exceed tank capacity" test only verifies fuel state but doesn't check money deduction consistency. Adding a money assertion would align it with other tests. - While default full-tank behavior is indirectly tested through edge cases, an explicit dedicated test would improve clarity and documentation. These are low-priority suggestions and do not prevent the tests from validating the core functionality. Your implementation successfully covers all essential requirements from the task description.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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