DEV: Added qunit test functions and did minor refactoring

DEV: Added qunit test functions and did minor refactoring

https://github.com/discourse/discourse/commit/135191d1d194b1cd03eb0416b5c4f7bf1a319aaf

diff --git a/app/assets/javascripts/discourse/helpers/topic-status-icons.js.es6 b/app/assets/javascripts/discourse/helpers/topic-status-icons.js.es6
index f13973d..80076d7 100644
--- a/app/assets/javascripts/discourse/helpers/topic-status-icons.js.es6
+++ b/app/assets/javascripts/discourse/helpers/topic-status-icons.js.es6
@@ -14,9 +14,7 @@ export default Ember.ArrayProxy.extend({
       renderIconIf("archived", "lock", "archived");
     }
 
-    this.forEach(args => {
-      renderIconIf(...args);
-    });
+    this.forEach(args => renderIconIf(...args));
   }
 }).create({
   content: [
diff --git a/app/assets/javascripts/discourse/widgets/topic-status.js.es6 b/app/assets/javascripts/discourse/widgets/topic-status.js.es6
index fd72606..366fe46 100644
--- a/app/assets/javascripts/discourse/widgets/topic-status.js.es6
+++ b/app/assets/javascripts/discourse/widgets/topic-status.js.es6
@@ -14,8 +14,8 @@ export default createWidget("topic-status", {
     const result = [];
 
     TopicStatusIcons.render(topic, function(name, key) {
-      const iconArgs = key === "unpinned" ? { class: "unpinned" } : null,
-        icon = iconNode(name, iconArgs);
+      const iconArgs = key === "unpinned" ? { class: "unpinned" } : null;
+      const icon = iconNode(name, iconArgs);
 
       const attributes = {
         title: escapeExpression(I18n.t(`topic_statuses.${key}.help`))
diff --git a/test/javascripts/widgets/topic-status-test.js.es6 b/test/javascripts/widgets/topic-status-test.js.es6
new file mode 100644
index 0000000..e0ed454
--- /dev/null
+++ b/test/javascripts/widgets/topic-status-test.js.es6
@@ -0,0 +1,37 @@
+import { moduleForWidget, widgetTest } from "helpers/widget-test";
+import TopicStatusIcons from "discourse/helpers/topic-status-icons";
+
+moduleForWidget("topic-status");
+
+widgetTest("basics", {
+  template: '{{mount-widget widget="topic-status" args=args}}',
+  beforeEach(store) {
+    this.set("args", {
+      topic: store.createRecord("topic", { closed: true }),
+      disableActions: true
+    });
+  },
+  test(assert) {
+    assert.ok(find(".topic-status .d-icon-lock").length);
+  }
+});
+
+widgetTest("extendability", {
+  template: '{{mount-widget widget="topic-status" args=args}}',
+  beforeEach(store) {
+    TopicStatusIcons.addObject([
+      "has_accepted_answer",
+      "check-square-o",
+      "solved"
+    ]);
+    this.set("args", {
+      topic: store.createRecord("topic", {
+        has_accepted_answer: true
+      }),
+      disableActions: true
+    });
+  },
+  test(assert) {
+    assert.ok(find(".topic-status .d-icon-check-square-o").length);
+  }
+});

GitHub sha: c773f82b