Skip to content

Commit 84b2311

Browse files
author
Ilya Nevolin
committed
unit tests improved
1 parent 5df3de9 commit 84b2311

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

tests.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
<script src="tests.js"></script>
1111
</head>
1212
<body>
13-
13+
<span>Test progress in Console (F12, Developer Tools)</span>
1414
</body>
1515
</html>

tests.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,32 @@ async function runner(testname, func) {
3030
let tz = "Europe/Brussels";
3131

3232
let A = await sp.get_appointment_types(PID, true)
33-
console.log(A)
33+
console.log({A})
3434
A.should.have.lengthOf(3) // default 3
3535

3636
let B = await sp.get_days_available(PID, A[0].id, dateNow(), tz, false)
37-
console.log(B)
37+
console.log({B})
3838
expect(B.days_available.length).to.be.at.least(1) // at least one day available this month
3939

4040
let C = await sp.get_slots_available(PID, A[0].id, dateNow(), dateTomorrow(), false)
41-
console.log(C)
41+
console.log({C})
4242
expect(C.slots_available.length).to.be.at.least(10) // each day has 96 15min slots (60*24 / 15 == 96)
4343

4444
let slot = C.slots_available[5].date
4545
let D = await sp.complete_booking(PID, A[0].id, slot, tz, 'Ilya', 'Nevolin', 'ilya2@nevolin.be', '111-111-7777', 'My Contact Type');
46-
console.log(D)
46+
console.log({D})
4747
D.should.have.property('appointment')
4848
expect(D.appointment.length).to.equal(60)
4949

50+
let E = await sp.list_appointments(KEY, 1000, 0, PID)
51+
console.log({E})
52+
E.should.have.property('data')
53+
E.data.should.have.property('appointments')
54+
expect(E.data.appointmentsCount).to.be.at.least(1)
55+
5056
let apid = D.appointment.id;
5157
let F = await sp.delete_appointment(apid, KEY)
52-
console.log(F)
58+
console.log({F})
5359
F.should.have.property('data')
5460
F.data.should.have.property('appointment')
5561
F.data.appointment.id.should.equal(D.appointment.id)
@@ -58,8 +64,10 @@ async function runner(testname, func) {
5864

5965
await runner('TEST 2', (async() => {
6066
let sp = new Spurwing();
61-
let E = await sp.list_appointments(KEY, 1000, 0, PID)
62-
console.log(E)
67+
let A = await sp.list_appointments(KEY, 1000, 0, PID)
68+
console.log({A})
69+
A.should.have.property('data')
70+
A.data.should.have.property('appointments')
6371
}));
6472

6573
})();

0 commit comments

Comments
 (0)