<commit_before>const test = require('tape');
const terminal = require('../game/terminalGame.js');
const helpers = require('../game/gameHelpers.js');

test('Can render the output by calling this function', function (t) {
  let returnVal = terminal.render('a string');
  t.equal(returnVal, console.log('a string'), 'The render function should return 1');
  t.end();
});

test('Can display the board with spaces rather than the letter e in empty spaces', function (t) {
  let board = ['O', 'e', 'X', 'O', 'X', 'O', 'X', 'O', 'e'];
  let displayBoard = terminal.getBoard(board);
  let output = '\n  ' + 'O' + ' |' + ' ' + ' ' + ' |' + ' ' + 'X' +
               '\n ===+===+===\n' +
               '  ' + 'O' + ' |' + ' ' + 'X' + ' |' + ' ' + 'O' +
               '\n ===+===+===\n' +
               '  ' + 'X' + ' |' + ' ' + 'O' + ' |' + ' ' + ' ' + '\n';
  t.equal(displayBoard, output, 'Result should be a matching board');
  t.end();
});

// test('It can start listening for inputs', function (t) {
//   let listening = terminal.listen();
//   t.equal(listening, process.openStdin(), 'It should be listening');
//   process.exit();
//   t.end();
// })
<commit_msg>Adds further tests to terminal.test.js<commit_after>const test = require('tape');
const terminal = require('../game/terminalGame.js');
const helpers = require('../game/gameHelpers.js');

test('It can log the output by calling this function', function (t) {
  let returnVal = terminal.render('a string');
  t.equal(returnVal, console.log('a string'), 'The render function should log the string');
  t.end();
});

test('It can write the output by calling this function', function (t) {
  let returnVal = terminal.write('another string\n');
  t.equal(returnVal, process.stdout.write('another string\n'), 'The write function should write the string');
  t.end();
});

test('Can display the board with spaces rather than the letter e in empty spaces', function (t) {
  let board = ['O', 'e', 'X', 'O', 'X', 'O', 'X', 'O', 'e'];
  let displayBoard = terminal.getBoard(board);
  let output = '\n  ' + 'O' + ' |' + ' ' + ' ' + ' |' + ' ' + 'X' +
               '\n ===+===+===\n' +
               '  ' + 'O' + ' |' + ' ' + 'X' + ' |' + ' ' + 'O' +
               '\n ===+===+===\n' +
               '  ' + 'X' + ' |' + ' ' + 'O' + ' |' + ' ' + ' ' + '\n';
  t.equal(displayBoard, output, 'Result should be a matching board');
  t.end();
});

test('It can start listening for inputs and stop listening', function (t) {
  let listening = terminal.listen();
  t.equal(listening, process.openStdin(), 'It should be listening');
  t.end();
  terminal.exit();
});

{'fraction_non_alphanumeric': 0.2272379495026779, 'fraction_numerical': 0.00038255547054322876, 'mean_word_length': 2.9205397301349327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1850038', 'n_tokens_mistral': 881, 'n_tokens_neox': 877, 'n_words': 247}