This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js
Robin Ward 23f24bfb51 REFACTOR: Move javascript tests inside discourse app
This is where they should be as far as ember is concerned. Note this is
a huge commit and we should be really careful everything continues to
work properly.
2020-10-02 11:29:36 -04:00

33 lines
934 B
JavaScript

import EmberObject from "@ember/object";
moduleFor("controller:preferences/account");
QUnit.test("updating of associated accounts", function (assert) {
const controller = this.subject({
siteSettings: {
enable_google_oauth2_logins: true,
},
model: EmberObject.create({
id: 70,
second_factor_enabled: true,
is_anonymous: true,
}),
currentUser: EmberObject.create({
id: 1234,
}),
site: EmberObject.create({
isMobileDevice: false,
}),
});
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
controller.set("model.second_factor_enabled", false);
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
controller.set("model.is_anonymous", false);
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
controller.set("model.id", 1234);
assert.equal(controller.get("canUpdateAssociatedAccounts"), true);
});