<commit_before>var query = require('../lib/index.js');
var expect = require('chai').expect;

describe('Action methods', function() {

  beforeEach( function(){
    query.reset();
  });

  // ## .create( payload, cb )
  describe('.create( payload [, cb] )', function() {

    it('fails if no .from(model) is set', function() {
      var cb = function( err, res ) {
        expect( err ).to.exist;;
        // Loosely check that the error message indicts "select"
        expect( err ).to.match( /from.*?action/ig );
      };
      query().create('record', cb);
    });

    it('fails if callback not a function', function() {
      var err;
      try {
        query().from('boop').create('payload', 'fakefunction');
      }
      catch( e ) {
        err = e;
      }
      expect( err ).to.be.an.instanceof( Error );
      expect( err.message ).to.match( /requires.*Function/ );
    });

    it('callback passed `query` object on success', function(done) {
      var cb = function( err, res ) {
        expect( res ).to.not.be.empty;<commit_msg>Tiny lint fix<commit_after>var query = require('../lib/index.js');
var expect = require('chai').expect;

describe('Action methods', function() {

  beforeEach( function(){
    query.reset();
  });

  // ## .create( payload, cb )
  describe('.create( payload [, cb] )', function() {

    it('fails if no .from(model) is set', function() {
      var cb = function( err, res ) {
        expect( err ).to.exist;
        // Loosely check that the error message indicts "select"
        expect( err ).to.match( /from.*?action/ig );
      };
      query().create('record', cb);
    });

    it('fails if callback not a function', function() {
      var err;
      try {
        query().from('boop').create('payload', 'fakefunction');
      }
      catch( e ) {
        err = e;
      }
      expect( err ).to.be.an.instanceof( Error );
      expect( err.message ).to.match( /requires.*Function/ );
    });

    it('callback passed `query` object on success', function(done) {
      var cb = function( err, res ) {
        expect( res ).to.not.be.empty;
{'fraction_non_alphanumeric': 0.1793400286944046, 'fraction_numerical': 0.0, 'mean_word_length': 2.379644588045234, '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': '195012', 'n_tokens_mistral': 653, 'n_tokens_neox': 637, 'n_words': 175}