<commit_before>// Copyright IBM Corp. 2014,2016. All Rights Reserved.
// Node module: loopback-boot
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var async = require('async');
var boot = require('../');
var path = require('path');
var loopback = require('loopback');
var assert = require('assert');
var expect = require('chai').expect;
var fs = require('fs-extra');
var sandbox = require('./helpers/sandbox');
var appdir = require('./helpers/appdir');
var supertest = require('supertest');
var os = require('os');

var SIMPLE_APP = path.join(__dirname, 'fixtures', 'simple-app');
var ENV_APP = path.join(__dirname, 'fixtures', 'env-app');

var app;

describe('executor', function() {
  beforeEach(sandbox.reset);

  beforeEach(appdir.init);

  beforeEach(function() {
    app = loopback();

    // process.bootFlags is used by simple-app/boot/*.js scripts
    process.bootFlags = [];
  });

  afterEach(function() {
    delete process.bootFlags;
  });

  var dummyInstructions = someInstructions({
    config: {
      port: 0,
      host: '127.0.0.1',
      restApiRoot: '/rest-api',
      foo: { bar: 'bat' },
      baz: true,
    },
    models: [
      {
        name: 'User',
        config: {
          dataSource: 'the-db',
        },
      },
    ],
    dataSources: {
      'the-db': {
        connector: 'memory',
        defaultForType: 'db',
      },
    },
  });

  describe('when booting', function() {
    it('should set the `booting` flag during execution', function(done) {
      expect(app.booting).to.be.undefined();
      boot.execute(app, simpleAppInstructions(), function(err) {
        expect(err).to.be.undefined();
        expect(process.bootingFlagSet).to.be.true();
        expect(app.booting).to.be.false();
        done();
      });
    });<commit_msg>Remove "defaultForType" from datasource config<commit_after>// Copyright IBM Corp. 2014,2016. All Rights Reserved.
// Node module: loopback-boot
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var async = require('async');
var boot = require('../');
var path = require('path');
var loopback = require('loopback');
var assert = require('assert');
var expect = require('chai').expect;
var fs = require('fs-extra');
var sandbox = require('./helpers/sandbox');
var appdir = require('./helpers/appdir');
var supertest = require('supertest');
var os = require('os');

var SIMPLE_APP = path.join(__dirname, 'fixtures', 'simple-app');
var ENV_APP = path.join(__dirname, 'fixtures', 'env-app');

var app;

describe('executor', function() {
  beforeEach(sandbox.reset);

  beforeEach(appdir.init);

  beforeEach(function() {
    app = loopback();

    // process.bootFlags is used by simple-app/boot/*.js scripts
    process.bootFlags = [];
  });

  afterEach(function() {
    delete process.bootFlags;
  });

  var dummyInstructions = someInstructions({
    config: {
      port: 0,
      host: '127.0.0.1',
      restApiRoot: '/rest-api',
      foo: { bar: 'bat' },
      baz: true,
    },
    models: [
      {
        name: 'User',
        config: {
          dataSource: 'the-db',
        },
      },
    ],
    dataSources: {
      'the-db': {
        connector: 'memory',
      },
    },
  });

  describe('when booting', function() {
    it('should set the `booting` flag during execution', function(done) {
      expect(app.booting).to.be.undefined();
      boot.execute(app, simpleAppInstructions(), function(err) {
        expect(err).to.be.undefined();
        expect(process.bootingFlagSet).to.be.true();
        expect(app.booting).to.be.false();
        done();
      });
    });
{'fraction_non_alphanumeric': 0.17040843927508792, 'fraction_numerical': 0.008114687584527996, 'mean_word_length': 2.92152704135737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6305892', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1142, 'n_words': 266}