forked from GladysAssistant/Gladys
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close GladysAssistant#450 : Add ability to create notification from R…
…EST API
- Loading branch information
1 parent
fea838e
commit 57227c1
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
test/unit/api/controllers/Notification/notification.create.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var request = require('supertest'); | ||
|
||
describe('Notification', function() { | ||
describe('create', function() { | ||
it('should create a notification', function(done) { | ||
var notification = { | ||
title: 'Fire !', | ||
text: 'Sir, there is a fire in the kitchen !', | ||
icon: 'fa fa-fire', | ||
iconColor: 'bg-yellow', | ||
priority: 2 | ||
}; | ||
|
||
request(sails.hooks.http.app) | ||
.post('/notification?token=test') | ||
.send(notification) | ||
.expect(201) | ||
.end(function(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
|
||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |