-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersonenauto.test.ts
127 lines (108 loc) · 3.3 KB
/
personenauto.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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 totalPersonenauto = total(VehicleType.Personenauto);
const totalBenzine = totalPersonenauto(PropulsionType.Benzine);
const totalDiesel = totalPersonenauto(PropulsionType.Diesel);
const totalElektrisch = totalPersonenauto(PropulsionType.Elektrisch);
const totalWaterstof = totalPersonenauto(PropulsionType.Waterstof);
/**
* @todo indien niet woonachtig in nederland, worden opcenten niet meegerekend
* in baseline. volgens de wet zou dat wel moeten. missen wij iets?
* http://wetten.overheid.nl/jci1.3:c:BWBR0005645&titeldeel=IV&hoofdstuk=XV¶graaf=2&artikel=222a&lid=4
*/
test.failing("Benzine/1/no_province", () => {
expect(totalBenzine(1, null, 100)).toBe(18);
});
test("Benzine/1/Utrecht", () => {
expect(totalBenzine(1, Province.Utrecht, 100)).toBe(30);
});
test("Benzine/1000/Utrecht", () => {
expect(totalBenzine(1000, Province.Utrecht, 100)).toBe(107);
});
test("Benzine/5000/Utrecht", () => {
expect(totalBenzine(5000, Province.Utrecht, 100)).toBe(999);
});
test("Diesel/1/no_province", () => {
expect(totalDiesel(1, null, 100)).toBe(102);
});
test("Diesel/1/Utrecht", () => {
expect(totalDiesel(1, Province.Utrecht, 100)).toBe(103);
});
test("Diesel/1000/Utrecht", () => {
expect(totalDiesel(1000, Province.Utrecht, 100)).toBe(255);
});
test("Diesel/5000/Utrecht", () => {
expect(totalDiesel(5000, Province.Utrecht, 100)).toBe(1727);
});
test("Diesel+fijnstoftoeslag/1/no_province", () => {
expect(totalDiesel(1, null, 100, { particulateMatterSurtax: true })).toBe(
119
);
});
test("Diesel+fijnstoftoeslag/1/Utrecht", () => {
expect(
totalDiesel(1, Province.Utrecht, 100, { particulateMatterSurtax: true })
).toBe(121);
});
test("Diesel+fijnstoftoeslag/1000/Utrecht", () => {
expect(
totalDiesel(1000, Province.Utrecht, 100, {
particulateMatterSurtax: true,
})
).toBe(297);
});
/**
* @todo we receive 1978 while the baseline gives 1977. not sure what is wrong
* here.
*/
test.failing("Diesel+fijnstoftoeslag/5000/Utrecht", () => {
expect(
totalDiesel(5000, Province.Utrecht, 100, {
particulateMatterSurtax: true,
})
).toBe(1977);
});
test("Elektrisch/1000/Utrecht", () => {
expect(totalElektrisch(1000, Province.Utrecht, 100)).toBe(0);
});
test("Waterstof/1000/Utrecht", () => {
expect(totalWaterstof(1000, Province.Utrecht, 100)).toBe(0);
});
test("Benzine_low_emission/1000/Utrecht", () => {
expect(totalBenzine(1000, Province.Utrecht, 50)).toBe(53);
});
test("Benzine_no_emission/1000/Utrecht", () => {
expect(totalBenzine(1000, Province.Utrecht, 0)).toBe(0);
});