Skip to content

Add test#320

Open
zhyliaieva wants to merge 3 commits into
mate-academy:masterfrom
zhyliaieva:develop
Open

Add test#320
zhyliaieva wants to merge 3 commits into
mate-academy:masterfrom
zhyliaieva:develop

Conversation

@zhyliaieva

Copy link
Copy Markdown

qa_fill-tank.git

@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

The test file has critical gaps in coverage. Only one test case exists, but the task requires testing all six rules. Missing tests for: (2) tank capacity overflow handling, (3) client payment limit constraints, (4) rounding poured amount to tenth, (5) minimum 2-liter threshold, and (6) price rounding to hundredth. Additionally, there's an empty placeholder test it('should ') that should be removed. All six functional rules from the requirements must have corresponding test cases before this can be approved.


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/fillTank.test.js Outdated
// const { fillTank } = require('./fillTank');
const { fillTank } = require('./fillTank');

it('should ', () => {});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove this empty placeholder test or replace it with a meaningful test case

Comment thread src/fillTank.test.js
Comment on lines +9 to +18
it('should fill full tank when amount is not provided', () => {
const customer = {
money: 1000,
vehicle: { maxTankCapacity: 40, fuelRemains: 10 },
};

fillTank(customer, 10);

expect(customer.vehicle.fuelRemains).toBe(40);
expect(customer.money).toBe(700);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add tests for rule #2: when amount exceeds tank capacity, should pour only what fits

Comment thread src/fillTank.test.js
Comment on lines +9 to +18
it('should fill full tank when amount is not provided', () => {
const customer = {
money: 1000,
vehicle: { maxTankCapacity: 40, fuelRemains: 10 },
};

fillTank(customer, 10);

expect(customer.vehicle.fuelRemains).toBe(40);
expect(customer.money).toBe(700);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add tests for rule #3: should always fill only what client can afford to pay

Comment thread src/fillTank.test.js
Comment on lines +9 to +18
it('should fill full tank when amount is not provided', () => {
const customer = {
money: 1000,
vehicle: { maxTankCapacity: 40, fuelRemains: 10 },
};

fillTank(customer, 10);

expect(customer.vehicle.fuelRemains).toBe(40);
expect(customer.money).toBe(700);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add tests for rule #4: verify poured amount is rounded down to tenth part (e.g., 15.37L becomes 15.3L)

Comment thread src/fillTank.test.js
Comment on lines +9 to +18
it('should fill full tank when amount is not provided', () => {
const customer = {
money: 1000,
vehicle: { maxTankCapacity: 40, fuelRemains: 10 },
};

fillTank(customer, 10);

expect(customer.vehicle.fuelRemains).toBe(40);
expect(customer.money).toBe(700);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add tests for rule #5: if poured amount is less than 2 liters, do not pour at all

Comment thread src/fillTank.test.js
Comment on lines +9 to +18
it('should fill full tank when amount is not provided', () => {
const customer = {
money: 1000,
vehicle: { maxTankCapacity: 40, fuelRemains: 10 },
};

fillTank(customer, 10);

expect(customer.vehicle.fuelRemains).toBe(40);
expect(customer.money).toBe(700);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add tests for rule #6: verify price is rounded to nearest hundredth part

@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 solution is approved. The test file now comprehensively covers all six functional requirements for the fillTank function, including edge cases for full tank scenarios, capacity limits, payment constraints, rounding behavior, and price calculations. All previously missing test cases have been successfully added and validated. The only noted issue is a low-priority test case that expects NaN values, which doesn't affect the core functionality being tested. Great work implementing a complete test suite!


✨ 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