mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 03:25:31 -05:00
be9feeb918
This is a lot simpler and removes the need for stubbing singletons in unit tests.
19 lines
644 B
JavaScript
19 lines
644 B
JavaScript
moduleFor("controller:user-dropdown");
|
|
|
|
test("logout action logs out the current user", function () {
|
|
const logoutMock = sinon.mock(Discourse, "logout");
|
|
logoutMock.expects("logout").once();
|
|
|
|
this.subject().send('logout');
|
|
|
|
logoutMock.verify();
|
|
});
|
|
|
|
test("showAdminLinks", function() {
|
|
const currentUser = Ember.Object.create({ staff: true });
|
|
const controller = this.subject({ currentUser });
|
|
equal(controller.get("showAdminLinks"), true, "is true when current user is a staff member");
|
|
|
|
currentUser.set("staff", false);
|
|
equal(controller.get("showAdminLinks"), false, "is false when current user is not a staff member");
|
|
});
|