Skip to content

Commit ac928eb

Browse files
committed
Add is called tests
1 parent 3f3ebda commit ac928eb

File tree

1 file changed

+21
-0
lines changed
  • Workshop/03. Unit-testing/public/test

1 file changed

+21
-0
lines changed

Workshop/03. Unit-testing/public/test/tests.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ describe('Tests', function() {
2424
requester.getJSON.restore();
2525
});
2626

27+
it('expect dataService.cookies() to make exactly one getJSON call', function(done) {
28+
dataService.cookies()
29+
.then(() => {
30+
expect(requester.getJSON.calledOnce).to.be.true;
31+
})
32+
.then(done, done);
33+
})
2734
it('expect dataService.cookies() to make correct getJSON call', function(done) {
2835
dataService.cookies()
2936
.then(obj => {
@@ -55,6 +62,13 @@ describe('Tests', function() {
5562
requester.postJSON.restore();
5663
});
5764

65+
it('expect postJSON to be called once', function(done) {
66+
dataService.register(user)
67+
.then(() => {
68+
expect(requester.postJSON.calledOnce).to.be.true;
69+
})
70+
.then(done, done);
71+
});
5872
it('expect dataService.register() to make correct postJSON call', function(done) {
5973
dataService.register(user)
6074
.then(() => {
@@ -129,6 +143,13 @@ describe('Tests', function() {
129143
localStorage.clear();
130144
});
131145

146+
it('expect putJSON to be called once', function(done) {
147+
dataService.login(user)
148+
.then(() => {
149+
expect(requester.putJSON.calledOnce).to.be.true;
150+
})
151+
.then(done, done);
152+
});
132153
it('expect dataService.login() to make correct putJSON call', function(done) {
133154
dataService.login(user)
134155
.then(() => {

0 commit comments

Comments
 (0)