{"size": 1650, "ext": "js", "max_stars_repo_path": "day03/snail.test.js", "max_stars_repo_name": "mbchoa/code-katas", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "day03/snail.test.js", "max_issues_repo_name": "mbchoa/code-katas", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "day03/snail.test.js", "max_forks_repo_name": "mbchoa/code-katas", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 12.9921259843, "max_line_length": 43, "alphanum_fraction": 0.3175757576}
import snail from './snail';

const Test = {
  assertDeepEquals(a, b) {
    expect(a).toEqual(b);
  },
};

test('empty case', () => {
  Test.assertDeepEquals(snail([[]]), []);
});

test('1 element', () => {
  Test.assertDeepEquals(snail([[1]]), [1]);
});

test('case #1: odd grid', () => {
  Test.assertDeepEquals(
    snail([
      [1, 2, 3],
      [4, 5, 6],
      [7, 8, 9],
    ]),
    [1, 2, 3, 6, 9, 8, 7, 4, 5]
  );
});

test('case #2: even grid', () => {
  Test.assertDeepEquals(
    snail([
      [1, 2],
      [3, 4],
    ]),
    [1, 2, 4, 3]
  );
});

test('case #3', () => {
  Test.assertDeepEquals(
    snail([
      [1, 2, 3, 4, 5],
      [6, 7, 8, 9, 10],
      [11, 12, 13, 14, 15],
      [16, 17, 18, 19, 20],
      [21, 22, 23, 24, 25],
    ]),
    [
      1,
      2,
      3,
      4,
      5,
      10,
      15,
      20,
      25,
      24,
      23,
      22,
      21,
      16,
      11,
      6,
      7,
      8,
      9,
      14,
      19,
      18,
      17,
      12,
      13,
    ]
  );
});

test('case #4', () => {
  Test.assertDeepEquals(
    snail([
      [1, 2, 3, 4, 5, 6],
      [20, 21, 22, 23, 24, 7],
      [19, 32, 33, 34, 25, 8],
      [18, 31, 36, 35, 26, 9],
      [17, 30, 29, 28, 27, 10],
      [16, 15, 14, 13, 12, 11],
    ]),
    [
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13,
      14,
      15,
      16,
      17,
      18,
      19,
      20,
      21,
      22,
      23,
      24,
      25,
      26,
      27,
      28,
      29,
      30,
      31,
      32,
      33,
      34,
      35,
      36,
    ]
  );
});
