<commit_before>import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
import { buildQueryParams, Transforms } from 'ember-parachute';

const {
  on,
  run
} = Ember;

const QueryParams = buildQueryParams({
  direction: {
    name: 'dir',
    defaultValue: 'asc',
    normalize: Transforms.String,
    refresh: true
  },
  page: {
    defaultValue: 1,
    normalize: Transforms.Number,
    refresh: true
  },
  showMenu: {
    defaultValue: true,
    normalize: Transforms.Boolean,
    refresh: false
  },
  search: {
    defaultValue: '',
    normalize: Transforms.String,
    refresh: true
  },
  sort: {
    defaultValue: 'name',
    normalize: Transforms.String,
    refresh: true
  },
});

const Controller =  Ember.Controller.extend(QueryParams.Mixin);
let service;

function getController(service, routeName) {
  return service.cacheFor(routeName).controller;
}

moduleFor('service:qp', 'Integration | Service | qp', {
  integration: true,

  beforeEach() {
    this.register('controller:index', Controller);
    service = this.subject()
  }
});

test('queryParamsDidChange get called on updated', function(assert) {
  assert.expect(1);

  let done = assert.async();
  this.register('controller:index', Controller.extend({
    queryParamsDidChange() {
      assert.ok(true);
      done();
    }
  }));

  run(() => {
    let controller = getController(service, 'index');
    service.update('index', controller);
  });
});

test('queryParamsDidChange event gets triggered on updated', function(assert) {
  assert.expect(1);

  let done = assert.async();
  this.register('controller:index', Controller.extend({
    onChanged: on('queryParamsDidChange', function() {
      assert.ok(true);
      done();
    })
  }));

  run(() => {
    let controller = getController(service, 'index');
    service.update('index', controller);
  });
});<commit_msg>Fix typo<commit_after>import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
import { buildQueryParams, Transforms } from 'ember-parachute';

const {
  on,
  run
} = Ember;

const QueryParams = buildQueryParams({
  direction: {
    name: 'dir',
    defaultValue: 'asc',
    normalize: Transforms.String,
    refresh: true
  },
  page: {
    defaultValue: 1,
    normalize: Transforms.Number,
    refresh: true
  },
  showMenu: {
    defaultValue: true,
    normalize: Transforms.Boolean,
    refresh: false
  },
  search: {
    defaultValue: '',
    normalize: Transforms.String,
    refresh: true
  },
  sort: {
    defaultValue: 'name',
    normalize: Transforms.String,
    refresh: true
  },
});

const Controller =  Ember.Controller.extend(QueryParams.Mixin);
let service;

function getController(service, routeName) {
  return service.cacheFor(routeName).controller;
}

moduleFor('service:qp', 'Integration | Service | qp', {
  integration: true,

  beforeEach() {
    this.register('controller:index', Controller);
    service = this.subject()
  }
});

test('queryParamsDidChange get called on update', function(assert) {
  assert.expect(1);

  let done = assert.async();
  this.register('controller:index', Controller.extend({
    queryParamsDidChange() {
      assert.ok(true);
      done();
    }
  }));

  run(() => {
    let controller = getController(service, 'index');
    service.update('index', controller);
  });
});

test('queryParamsDidChange event gets triggered on update', function(assert) {
  assert.expect(1);

  let done = assert.async();
  this.register('controller:index', Controller.extend({
    onChanged: on('queryParamsDidChange', function() {
      assert.ok(true);
      done();
    })
  }));

  run(() => {
    let controller = getController(service, 'index');
    service.update('index', controller);
  });
});
{'fraction_non_alphanumeric': 0.1493975903614458, 'fraction_numerical': 0.001606425702811245, 'mean_word_length': 3.693467336683417, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7542286', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1142, 'n_words': 251}