-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkampeerauto.test.ts
92 lines (81 loc) · 2.32 KB
/
kampeerauto.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import {
Period,
PropulsionType,
Province,
VehicleType,
run,
type Params,
} from "@motorrijtuigenbelasting/core";
import model from "../src/index.js";
// Baseline is https://www.belastingdienst.nl/wps/wcm/connect/nl/auto-en-vervoer/content/hulpmiddel-motorrijtuigenbelasting-berekenen
const total =
(vehicleType: VehicleType) =>
(propulsionType: PropulsionType) =>
(
weight: number,
province: Province | null,
co2Emission: number,
rest: Omit<
Params,
"vehicleType" | "weight" | "province" | "propulsions"
> = {}
) => {
return run(
model,
{
vehicleType,
weight,
propulsions: [{ type: propulsionType, co2Emission }],
...rest,
province,
},
Period.quarter
).total;
};
const totalKampeerauto = total(VehicleType.Kampeerauto);
const totalBenzine = totalKampeerauto(PropulsionType.Benzine);
const totalDiesel = totalKampeerauto(PropulsionType.Diesel);
const totalElektrisch = totalKampeerauto(PropulsionType.Elektrisch);
const totalWaterstof = totalKampeerauto(PropulsionType.Waterstof);
test("Benzine/1000/Utrecht", () => {
expect(totalBenzine(1000, Province.Utrecht, 100)).toBe(26);
});
/**
* @todo we receive 52 while the baseline gives 65. not sure what is wrong
* here.
*/
test.failing("Benzine+bedrijfsmatig verhuurd/1000/Utrecht", () => {
expect(
totalDiesel(1000, Province.Utrecht, 100, {
rentedForBusinessPurposes: true,
})
).toBe(65);
});
test("Diesel/1000/Utrecht", () => {
expect(totalDiesel(1000, Province.Utrecht, 100)).toBe(63);
});
test("Diesel+fijnstoftoeslag/1000/Utrecht", () => {
expect(
totalDiesel(1000, Province.Utrecht, 100, {
particulateMatterSurtax: true,
})
).toBe(74);
});
test("Elektrisch/1000/Utrecht", () => {
expect(totalElektrisch(1000, Province.Utrecht, 100)).toBe(0);
});
test("Waterstof/1000/Utrecht", () => {
expect(totalWaterstof(1000, Province.Utrecht, 100)).toBe(0);
});
/**
* @todo this scenario is not covered in baseline calculator
*/
test.failing("Benzine_low_emission/1000/Utrecht", () => {
expect(totalBenzine(1000, Province.Utrecht, 50)).toBe(NaN);
});
/**
* @todo this scenario is not covered in baseline calculator
*/
test.failing("Benzine_no_emission/1000/Utrecht", () => {
expect(totalBenzine(1000, Province.Utrecht, 0)).toBe(NaN);
});