{"size": 1462, "ext": "js", "max_stars_repo_path": "WhiteBoard_Challenge_03/__test__/test.js", "max_stars_repo_name": "ClairJ/White_Board_Challenges", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "WhiteBoard_Challenge_03/__test__/test.js", "max_issues_repo_name": "ClairJ/White_Board_Challenges", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "WhiteBoard_Challenge_03/__test__/test.js", "max_forks_repo_name": "ClairJ/White_Board_Challenges", "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": 19.4933333333, "max_line_length": 67, "alphanum_fraction": 0.4268125855}
const solution = require('../lib/solution.js');

describe('solution.js', () => {
  describe('testing for actual object', () => {

    let expected = [];
    test('non objects should return null', () => {
      expect(solution.traverse(expected)).toBeNull;
    });

    let expected2 = {
      'value': 3,
      'next': {
        'value': 2,
        'next': {
          'value': 1,
          'next': null,
        },
      },
    };

    test('correct solution should return total passengers', () => {
      expect(solution.traverse(expected2)).toBe(6);
    });

    let expected3 = {
      'value': 3,
      'next': {
        'value': 2,
        'next': {
          'value': 1,
          'next': {
            'value': -1,
            'next': null,
          },
        },
      },
    };

    test('negative passangers dissallowed', () => {
      expect(solution.traverse(expected3)).toBe(6);
    });

    let expected4 = {
      'value': '',
      'next': {
        'value': '',
        'next': {
          'value': '',
          'next': null,
        },
      },
    };

    test('empty value should be null', () => {
      expect(solution.traverse(expected4)).toBeNull;
    });

    let expected5 = {
      'value': 0,
      'next': {
        'value': 3,
        'next': {
          'value': 2,
          'next': null,
        },
      },
    };

    test('zeros have no effect', () => {
      expect(solution.traverse(expected5)).toBe(5);
    });
  });
});
