-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first 10 % of #2124 - added initial version of JSON API tests - renamed error.errorCode to error.code - renamed tags.all to tags.browse for consistency
- Loading branch information
Showing
19 changed files
with
276 additions
and
43 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
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
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
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
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
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
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,49 @@ | ||
/*globals describe, before, beforeEach, afterEach, it */ | ||
var testUtils = require('../../utils'), | ||
should = require('should'), | ||
|
||
// Stuff we are testing | ||
DataGenerator = require('../../utils/fixtures/data-generator'), | ||
NotificationsAPI = require('../../../server/api/notifications'); | ||
|
||
describe('Notifications API', function () { | ||
|
||
before(function (done) { | ||
testUtils.clearData().then(function () { | ||
done(); | ||
}, done); | ||
}); | ||
|
||
beforeEach(function (done) { | ||
testUtils.initData() | ||
.then(function () { | ||
return testUtils.insertDefaultFixtures(); | ||
}) | ||
.then(function () { | ||
done(); | ||
}, done); | ||
}); | ||
|
||
afterEach(function (done) { | ||
testUtils.clearData().then(function () { | ||
done(); | ||
}, done); | ||
}); | ||
|
||
it('can browse', function (done) { | ||
var msg = { | ||
type: 'error', // this can be 'error', 'success', 'warn' and 'info' | ||
message: 'This is an error', // A string. Should fit in one line. | ||
status: 'persistent', // or 'passive' | ||
id: 'auniqueid' // A unique ID | ||
}; | ||
NotificationsAPI.add(msg).then(function (notification){ | ||
NotificationsAPI.browse().then(function (results) { | ||
should.exist(results); | ||
results.length.should.be.above(0); | ||
testUtils.API.checkResponse(results[0], 'notification'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.