Add workound for order-dependent notification_collection_spec.js

This is from Flaburgan: https://github.com/diaspora/diaspora/pull/8305/files

I can't find a better way around it. The specs that call `onChangedUnreadStatus` change the environment in ways we can't figure out how to reset cleanly.
This commit is contained in:
Sage Ross 2022-01-15 15:10:44 -08:00 committed by Benjamin Neff
parent 09ecaec0b5
commit 94956a2eda
No known key found for this signature in database
GPG key ID: 971464C3F1A90194

View file

@ -14,6 +14,12 @@ describe("app.collections.Notifications", function() {
it("initializes attributes", function() {
var target = new app.collections.Notifications();
/* I don't know how backbone is working, but if I don't force reset the old values are kept from previous test */
if (target !== undefined) {
target.unreadCount = 0;
target.unreadCountByType = {};
}
/* end of force refresh */
expect(target.model).toBe(app.models.Notification);
/* eslint-disable camelcase */
expect(target.url).toBe(Routes.notifications({per_page: 10, page: 1}));
@ -174,6 +180,12 @@ describe("app.collections.Notifications", function() {
describe("parse", function() {
beforeEach(function() {
this.target = new app.collections.Notifications();
/* I don't know how backbone is working, but if I don't force reset the old values are kept from previous test */
if (this.target !== undefined) {
this.target.unreadCount = 0;
this.target.unreadCountByType = {};
}
/* end of force refresh */
});
it("sets the unreadCount and unreadCountByType attributes", function() {