<commit_before>import assert from 'assert';
import feathers from 'feathers';
import hooks from 'feathers-hooks';
import memory from 'feathers-memory';
import seeder from '../lib';

describe('feathers-seeder', () => {
  describe('basic', () => {
    it('can seed a basic in-memory service', done => {
      const SINGLE = {
        path: 'single',
        template: {
          name: '{{name.firstName}} {{name.lastName}}'
        }
      };
      const MULTIPLE = {
        path: 'multiple',
        count: 24,
        template: {
          username: '{{internet.userName}}'
        }
      };
      const RANDOM = {
        path: 'random',
        count: 10,
        templates: [{
          username: '{{internet.userName}}'
        }, {
          password: '{{<PASSWORD>}}'
        }]
      };
      const ALL = {
        path: 'all',
        randomize: false,
        templates: [{
          username: '{{internet.userName}}',
          age: 34,
          updatedAt: new Date(),
          profileMedium: `https://dgalywyr863hv.cloudfront.net/pictures/athletes/411352/88294/1/medium.jpg`,
          active: true,
          location: {
            lat: 45.3455656,
            lng: -45.2656565
          }
        }, {
          username: '{{internet.userName}}',
          age: 33,
          updatedAt: new Date(),
          profileMedium: `https://dgalywyr863hv.cloudfront.net/pictures/athletes/411352/88294/1/medium.jpg`,
          active: false,
          location: {
            lat: 45.3455656,
            lng: -45.2656565
          }
        }]
      };

      const services = [];
      services.push(SINGLE, MULTIPLE, RANDOM,ALL);

      const app = feathers()
        .configure(hooks)
        .use(`/${SINGLE.path}`, memory())
        .use(`/${MULTIPLE.path}`, memory())
        .use(`/${RANDOM.path}`, memory())
        .use(`/${ALL.path}`, memory())
        .configure(seeder({
          services,
          debug: true
        }));

      app.seed().then(() => {
        app.service(`${SINGLE.path}`).find().then(items => {
          assert.equal(items.length, 1);
          console.log(`Seeded ${items.length}`);
        }).catch(done);

        app.service(`${MULTIPLE.path}`).find().then(items => {
          assert.equal(items.length, MULTIPLE.count);
          console.log(`Seeded ${items.length}`);
        }).catch(done);

        app.service(`${RANDOM.path}`).find().then(items => {
          assert.equal(items.length, RANDOM.count);
          console.log(`Seeded ${items.length}`);
        }).catch(done);

        app.service(`${ALL.path}`).find().then(items => {
          assert.equal(items.length, RANDOM.templates.length);
          console.log(`Seeded ${items.length}`);
        }).catch(done);

        done();
      }).catch(done);
    });
  });
});<commit_msg>Fix ALL test<commit_after>import assert from 'assert';
import feathers from 'feathers';
import hooks from 'feathers-hooks';
import memory from 'feathers-memory';
import seeder from '../lib';

describe('feathers-seeder', () => {
  describe('basic', () => {
    it('can seed a basic in-memory service', done => {
      const SINGLE = {
        path: 'single',
        template: {
          name: '{{name.firstName}} {{name.lastName}}'
        }
      };
      const MULTIPLE = {
        path: 'multiple',
        count: 24,
        template: {
          username: '{{internet.userName}}'
        }
      };
      const RANDOM = {
        path: 'random',
        count: 10,
        templates: [{
          username: '{{internet.userName}}'
        }, {
          password: '{{<PASSWORD>}}'
        }]
      };
      const ALL = {
        path: 'all',
        randomize: false,
        templates: [{
          username: '{{internet.userName}}',
          age: 34,
          updatedAt: new Date(),
          profileMedium: `https://dgalywyr863hv.cloudfront.net/pictures/athletes/411352/88294/1/medium.jpg`,
          active: true,
          location: {
            lat: 45.3455656,
            lng: -45.2656565
          }
        }, {
          username: '{{internet.userName}}',
          age: 33,
          updatedAt: new Date(),
          profileMedium: `https://dgalywyr863hv.cloudfront.net/pictures/athletes/411352/88294/1/medium.jpg`,
          active: false,
          location: {
            lat: 45.3455656,
            lng: -45.2656565
          }
        }]
      };

      const services = [];
      services.push(SINGLE, MULTIPLE, RANDOM,ALL);

      const app = feathers()
        .configure(hooks)
        .use(`/${SINGLE.path}`, memory())
        .use(`/${MULTIPLE.path}`, memory())
        .use(`/${RANDOM.path}`, memory())
        .use(`/${ALL.path}`, memory())
        .configure(seeder({
          services,
          debug: true
        }));

      app.seed().then(() => {
        app.service(`${SINGLE.path}`).find().then(items => {
          assert.equal(items.length, 1);
          console.log(`Seeded ${items.length}`);
        }).catch(done);

        app.service(`${MULTIPLE.path}`).find().then(items => {
          assert.equal(items.length, MULTIPLE.count);
          console.log(`Seeded ${items.length}`);
        }).catch(done);

        app.service(`${RANDOM.path}`).find().then(items => {
          assert.equal(items.length, RANDOM.count);
          console.log(`Seeded ${items.length}`);
        }).catch(done);

        app.service(`${ALL.path}`).find().then(items => {
          assert.equal(items.length, ALL.templates.length);
          console.log(`Seeded ${items.length}`);
        }).catch(done);

        done();
      }).catch(done);
    });
  });
});
{'fraction_non_alphanumeric': 0.1786609380594343, 'fraction_numerical': 0.02685284640171858, 'mean_word_length': 1.831728332488596, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 4, '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': '2795712', 'n_tokens_mistral': 1841, 'n_tokens_neox': 1730, 'n_words': 290}