Commits

Shlomi Fish committed 659ec5c

Extract a function to help in the tests.

I'll write a new test using it soon.

  • Participants
  • Parent commits 7b4b895

Comments (0)

Files changed (1)

File abc-path/js/abc-path-test.js

         equal(gen._get_num_connected(pos_s), 2);
     });
 
+    var calc_final_layout_string = function (final_layout) {
+        var got_matrix = final_layout._y_indexes().map(function (y) { 
+            return final_layout._x_indexes().map(function(x) {
+                return final_layout.get_letter_at_pos({y : y, x: x})
+            }
+            )
+            });
+
+        var got_string = [].concat.apply([], got_matrix).join('');
+
+        return got_string;
+    };
+
     test("calc_final_layout seed 1.", function() {
         expect(1);
 
             'GAKLO' +
             'HIJNM';
 
-        var got_matrix = final_layout._y_indexes().map(function (y) { 
-            return final_layout._x_indexes().map(function(x) {
-                return final_layout.get_letter_at_pos({y : y, x: x})
-            }
-            )
-            });
-
-        var got_string = [].concat.apply([], got_matrix).join('');
-
         // TEST
-        equal(got_string, expected_string, 'Layout with seed 1 is right.');
+        equal(calc_final_layout_string(final_layout), expected_string,
+            'Layout with seed 1 is right.');
     });
 }