-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
118 lines (96 loc) · 4.52 KB
/
test.js
File metadata and controls
118 lines (96 loc) · 4.52 KB
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
var assert = require('assert'),
ac = require('./ac.js'),
entry,
handleData;
entry = ac.entry;
handleData = ac.handleData;
exports.testRequestConfig = function (entryConfig) {
function matchEbk() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/-/-/-/4,1,5/-/-/true | |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Einbaukueche").matchCount, 1);
}
function matchProvision() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/-/-/-/4,1,5/-/-/-/-/-/-/-/-/-/-/-/-/true | enteredFrom=result_list |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Provisionsfrei").matchCount, 1);
}
function matchBalkon() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/-/-/-/4,1,5/-/-/-/-/true/-/-/-/-/-/-/-/true | enteredFrom=result_list |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Balkon/Terrasse").matchCount, 1);
}
function doNotMatchVicinitySearch() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Umkreissuche/Berlin/Berlin/-/-/-/-/ | |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Bundesland").matchCount, 0);
}
function doNotMatchError() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/-/-/-/ | |HTTP/1.1 |400 |19261 |275497 |");
assert.strictEqual(entry.findByName("Bundesland").matchCount, 0);
}
function doNotMatchPagedRequest() {
entry.init();
handleData("|GET |/Suche/S-/P-1/Wohnung-Miete/Berlin/Berlin/-/-/-/-/ | |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Bundesland").matchCount, 0);
}
function matchLivingTypeCriteriaGroup() {
var parent;
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/-/-/-/-/3,6 | |HTTP/1.1 |200 |19261 |275497 |");
parent = entry.findByName("Wohnungstypen");
assert.strictEqual(entry.findChildByName("Dachgeschoss", parent).matchCount, 1);
assert.strictEqual(entry.findChildByName("Loft", parent).matchCount, 1);
}
function matchHeatingCriteriaGroup() {
var parent;
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/-/-/-/4,1/3,6,128 | |HTTP/1.1 |200 |19261 |275497 |");
parent = entry.findByName("Heizungsart");
assert.strictEqual(entry.findChildByName("Ofenheizung", parent).matchCount, 1);
assert.strictEqual(entry.findChildByName("Etagenheizung", parent).matchCount, 1);
}
function matchRooms() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/2,00- | |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Zimmer").matchCount, 1);
}
function matchArea() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/-/0,00-90,00/- | |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Flaeche").matchCount, 1);
}
function matchPrice() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/-/-/-/EURO-500,00-1000,00/-/-/-/true | |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Preis").matchCount, 1);
}
function matchNewBuilding() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/Lichterfelde-Steglitz/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/true | |HTTP/1.1 |200 |19261 |275497 |");
assert.strictEqual(entry.findByName("Neubau").matchCount, 1);
}
function matchWBS() {
entry.init();
handleData("|GET |/Suche/S-/Wohnung-Miete/Berlin/Berlin/Lichterfelde-Steglitz/-/-/-/-/-/false | |HTTP/1.1 |200 |19261 |275497 |");
parent = entry.findByName("Wohnberechtigungsschein");
assert.strictEqual(parent.matchCount, 1);
assert.strictEqual(entry.findChildByName("erforderlich", parent).matchCount, 0);
assert.strictEqual(entry.findChildByName("nicht erforderlich", parent).matchCount, 1);
}
entry.config = entryConfig;
matchEbk();
matchProvision();
matchBalkon();
matchLivingTypeCriteriaGroup();
matchHeatingCriteriaGroup();
matchRooms();
matchArea();
matchPrice();
matchNewBuilding();
matchWBS();
doNotMatchVicinitySearch();
doNotMatchError();
doNotMatchPagedRequest();
}