[
{ "name": "1,000 kWh of grid electricity in 2024 is 207.05 kg", "args": ["electricity", 1000000, 2024], "expect": { "fuel": "electricity", "unit": "kWh", "year": 2024, "scope": 2, "factor": 20705, "grams": 207050 } },
{ "name": "the same electricity in 2026 uses the 2026 factor", "args": ["electricity", 1000000, 2026], "expect": { "fuel": "electricity", "unit": "kWh", "year": 2026, "scope": 2, "factor": 13096, "grams": 130960 } },
{ "name": "2023 electricity at the five published decimals", "args": ["electricity", 1000000, 2023], "expect": { "fuel": "electricity", "unit": "kWh", "year": 2023, "scope": 2, "factor": 20707, "grams": 207070 } },
{ "name": "transmission and distribution losses for the same 1,000 kWh in 2025", "args": ["electricity-td", 1000000, 2025], "expect": { "fuel": "electricity-td", "unit": "kWh", "year": 2025, "scope": 3, "factor": 1853, "grams": 18530 } },
{ "name": "a year of household gas, 12,000 kWh in 2025", "args": ["natural-gas", 12000000, 2025], "expect": { "fuel": "natural-gas", "unit": "kWh", "year": 2025, "scope": 1, "factor": 18296, "grams": 2195520 } },
{ "name": "a 50 litre diesel fill in 2026", "args": ["diesel", 50000, 2026], "expect": { "fuel": "diesel", "unit": "litres", "year": 2026, "scope": 1, "factor": 258354, "grams": 129177 } },
{ "name": "one litre of petrol in 2023 rounds 2097.47 g down", "args": ["petrol", 1000, 2023], "expect": { "fuel": "petrol", "unit": "litres", "year": 2023, "scope": 1, "factor": 209747, "grams": 2097 } },
{ "name": "1,000 litres of heating oil in 2024", "args": ["burning-oil", 1000000, 2024], "expect": { "fuel": "burning-oil", "unit": "litres", "year": 2024, "scope": 1, "factor": 254015, "grams": 2540150 } },
{ "name": "LPG by the litre", "args": ["lpg", 2500, 2025], "expect": { "fuel": "lpg", "unit": "litres", "year": 2025, "scope": 1, "factor": 155713, "grams": 3893 } },
{ "name": "an exact half gram rounds up: 10 kWh at 0.20705 is 2070.5 g", "args": ["electricity", 10000, 2024], "expect": { "fuel": "electricity", "unit": "kWh", "year": 2024, "scope": 2, "factor": 20705, "grams": 2071 } },
{ "name": "nothing burned is no emissions", "args": ["gas-oil", 0, 2026], "expect": { "fuel": "gas-oil", "unit": "litres", "year": 2026, "scope": 1, "factor": 275541, "grams": 0 } },
{ "name": "a gigawatt-hour stays exact past 2^53 in the intermediate product", "args": ["electricity", 1000000000000, 2024], "expect": { "fuel": "electricity", "unit": "kWh", "year": 2024, "scope": 2, "factor": 20705, "grams": 207050000000 } },
{ "name": "fuel oil, 3.17492 kg a litre", "args": ["fuel-oil", 1, 2026], "expect": { "fuel": "fuel-oil", "unit": "litres", "year": 2026, "scope": 1, "factor": 317492, "grams": 3 } },
{ "name": "a year with no factor set is an error, not another year's factor", "args": ["electricity", 1000, 2022], "expectError": "no conversion factor for electricity in 2022" },
{ "name": "an unknown fuel is refused", "args": ["coal", 1000, 2025], "expectError": "unknown fuel \"coal\"" },
{ "name": "a negative quantity is refused", "args": ["diesel", -1000, 2025], "expectError": "quantity must be a whole number of thousandths of a unit" },
{ "name": "a fractional quantity is refused", "args": ["diesel", 1000.5, 2025], "expectError": "quantity must be a whole number of thousandths of a unit" }
]