PERF: Fix N+1 queries when loading groups.

This commit is contained in:
Guo Xiang Tan
2016-11-25 15:26:49 +08:00
parent 712ff01f38
commit 5794f1619d
14 changed files with 73 additions and 44 deletions

View File

@ -1,4 +1,5 @@
import { acceptance } from "helpers/qunit-helpers";
import { acceptance, logIn } from "helpers/qunit-helpers";
acceptance("Groups");
test("Browsing Groups", () => {
@ -24,6 +25,18 @@ test("Browsing Groups", () => {
visit("/groups/discourse/messages");
andThen(() => {
ok($('.action-list li').length === 4, 'it should not show messages tab');
ok(count('.user-stream .item') > 0, "it lists stream items");
});
});
test("Messages tab", () => {
logIn();
Discourse.reset();
visit("/groups/discourse");
andThen(() => {
ok($('.action-list li').length === 5, 'it should show messages tab if user is admin');
});
});