<commit_before>const assert = require("assert");
const CommandRunner = require("../commandrunner");
const MemoryLogger = require("../memorylogger");
let config = {};

describe("truffle help", () => {
  const logger = new MemoryLogger();
  beforeEach("set up config for logger", () => {
    config.logger = logger;
  });

  describe("when it is run without arguments", () => {
    it("displays general help", function(done) {
      CommandRunner.run("help", config, (error) => {
        const output = logger.contents();

        assert(output.includes("Usage: truffle <command> [options]"));
        done();
      });
    });
  })

  describe("when it is run with an argument", () => {
    it("tells the user if it doesn't recognize the given command", function(done) {
      CommandRunner.run("help eggplant", config, (error) => {
        const output = logger.contents();

        assert(output.includes("Cannot find the given command 'eggplant'"));
        done();
      });
    });

    it("displays help for the given command if it is valid", function(done) {
      CommandRunner.run("help compile", config, (error) => {
        const output = logger.contents();

        assert(output.includes("truffle compile [--list <prereleases|releases|docker>] [--all] [--network <name>]"));
        done();
      });
    });<commit_msg>Make testing it statements briefer<commit_after>const assert = require("assert");
const CommandRunner = require("../commandrunner");
const MemoryLogger = require("../memorylogger");
let config = {};

describe("truffle help", () => {
  const logger = new MemoryLogger();
  beforeEach("set up config for logger", () => {
    config.logger = logger;
  });

  describe("when run without arguments", () => {
    it("displays general help", function(done) {
      CommandRunner.run("help", config, (error) => {
        const output = logger.contents();

        assert(output.includes("Usage: truffle <command> [options]"));
        done();
      });
    });
  })

  describe("when run with an argument", () => {
    it("tells the user if it doesn't recognize the given command", function(done) {
      CommandRunner.run("help eggplant", config, (error) => {
        const output = logger.contents();

        assert(output.includes("Cannot find the given command 'eggplant'"));
        done();
      });
    });

    it("displays help for the given command when valid", function(done) {
      CommandRunner.run("help compile", config, (error) => {
        const output = logger.contents();

        assert(output.includes("truffle compile [--list <prereleases|releases|docker>] [--all] [--network <name>]"));
        done();
      });
    });
{'fraction_non_alphanumeric': 0.16860247283626825, 'fraction_numerical': 0.0, 'mean_word_length': 3.204724409448819, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5519438', 'n_tokens_mistral': 745, 'n_tokens_neox': 711, 'n_words': 204}