<commit_before>var exec = require("child_process").exec;
var rm = require("rimraf");
var helpers = require("../helpers/utils");
var should = require('chai').should();

describe("Command `em gen`", function() {
  it("should have an argument which contain a ':'", function(done){
    exec("./bin/em gen route", function(error, stdout, stderr) {
      // need to test the program should successfully shut down
      stdout.should.include('[-Error:]');
      stdout.should.include('Provide the wrong argument.');
      stdout.should.include('type:name');
      stdout.should.include('See \'em gen --help\'');
      done();
    });
  });

  it("should have a right type. ex: route, controller, view, template", function(done){
    exec("./bin/em gen temp:post", function(error, stdout, stderr) {
      stdout.should.include('[-Error:]');
      stdout.should.include('temp  is not a valid type.');
      stdout.should.include('[-note:]');
      stdout.should.include('valid types are component, controller, helper, model, route, template, view, mixin, adapter');
      done();
    });
  });
});

describe("Command `em gen`", function() {
    afterEach(function(done) {
      rm("./client", done);
    });

    it("should generate a js file at app/routes/ folder", function(done){
      exec("./bin/em gen routes:post", function(error, stdout, stderr) {
        stdout.should.include('[-done:]');
        helpers.assertPathExist('client/app/routes/post.js', done);
      });
    });
});<commit_msg>adding a new test to handle the case of type is singular or plural, ex: route:post or routes:post<commit_after>var exec = require("child_process").exec;
var rm = require("rimraf");
var helpers = require("../helpers/utils");
var should = require('chai').should();

describe("Command `em gen`", function() {
  it("should have an argument which contain a ':'", function(done){
    exec("./bin/em gen route", function(error, stdout, stderr) {
      // need to test the program should successfully shut down
      stdout.should.include('[-Error:]');
      stdout.should.include('Provide the wrong argument.');
      stdout.should.include('type:name');
      stdout.should.include('See \'em gen --help\'');
      done();
    });
  });

  it("should have a right type. ex: route, controller, view, template", function(done){
    exec("./bin/em gen temp:post", function(error, stdout, stderr) {
      stdout.should.include('[-Error:]');
      stdout.should.include('temp  is not a valid type.');
      stdout.should.include('[-note:]');
      stdout.should.include('valid types are component, controller, helper, model, route, template, view, mixin, adapter');
      done();
    });
  });
});

describe("Command `em gen`", function() {
    afterEach(function(done) {
      rm("./client", done);
    });

    // handle the case of type is singular or plural, ex: route:post or routes:post
    it("should generate a js file at app/routes/ folder when type is 'route'", function(done){
      exec("./bin/em gen route:post", function(error, stdout, stderr) {
        stdout.should.include('[-done:]');
        helpers.assertPathExist('client/app/routes/post.js', done);
      });
    });

    // handle the case of type is singular or plural, ex: route:post or routes:post
    it("should generate a js file at app/routes/ folder when type is 'routes'", function(done){
      exec("./bin/em gen routes:post", function(error, stdout, stderr) {
        stdout.should.include('[-done:]');
        helpers.assertPathExist('client/app/routes/post.js', done);
      });
    });
});
{'fraction_non_alphanumeric': 0.17506332676611314, 'fraction_numerical': 0.0, 'mean_word_length': 3.4259028642590286, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3378052', 'n_tokens_mistral': 1063, 'n_tokens_neox': 1038, 'n_words': 295}