{"size": 1175, "ext": "js", "max_stars_repo_path": "src/lib/conversion.test.js", "max_stars_repo_name": "rix1/46brew", "max_stars_repo_stars_event_min_datetime": "2020-04-25T01:20:27.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-06T14:42:41.000Z", "max_issues_repo_path": "src/lib/conversion.test.js", "max_issues_repo_name": "rix1/46brew", "max_issues_repo_issues_event_min_datetime": "2019-08-24T13:16:53.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-24T04:40:37.000Z", "max_forks_repo_path": "src/lib/conversion.test.js", "max_forks_repo_name": "rix1/46brew", "max_forks_repo_forks_event_min_datetime": "2020-04-25T01:20:21.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-25T01:20:21.000Z"}
{"max_stars_count": 4, "max_issues_count": 42, "max_forks_count": 1, "avg_line_length": 25.0, "max_line_length": 67, "alphanum_fraction": 0.6127659574}
/* eslint-env jest */

import {
  coffeeToWater,
  waterToCoffee,
  coffeeConverter,
  getCoffeeWeight,
} from './conversion';

describe('coffee to water', () => {
  it('converts coffee to water correctly', () => {
    expect(coffeeToWater(26)).toBe(400);
  });
  it('rounds properly', () => {
    expect(coffeeToWater(22)).toBe(338.5);
  });
});

describe('water to coffee', () => {
  it('converts water to coffee correctly', () => {
    expect(waterToCoffee(400)).toBe(26);
  });
  it('rounds properly', () => {
    expect(waterToCoffee(350)).toBe(22.8);
  });
});

describe('coffeeConverter', () => {
  it('converts water to coffee correctly', () => {
    expect(coffeeConverter(400, 'water')).toBe(26);
  });
  it('converts coffee to water correctly', () => {
    expect(coffeeConverter(26, 'coffee')).toBe(400);
  });
});

describe('getCoffeeWeight', () => {
  it('returns coffee weight if type is coffee', () => {
    const inputValue = 22;
    expect(getCoffeeWeight(inputValue, 'coffee')).toBe(inputValue);
  });
  it('returns coffee weight if type is water', () => {
    const inputValue = 224;
    expect(getCoffeeWeight(inputValue, 'water')).toBe(14.6);
  });
});
