<commit_before>import {
  moduleForModel,
  test
} from 'ember-qunit';
import Ember from 'ember';
import modelList from '../../helpers/model-list';

moduleForModel('user', 'User', {
  needs: modelList
});

test('it exists', function(assert) {
  var model = this.subject();
  // var store = this.store();
  assert.ok(!!model);
});

test('gets all directed courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  let courses = [];
  Ember.run(()=>{
    courses.pushObject(store.createRecord('course', {
      directors: [model]
    }));
    courses.pushObject(store.createRecord('course', {
      directors: [model]
    }));
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
      });
    });
  });
  
});

test('gets all learner group courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  Ember.run(()=>{
    let course1 = store.createRecord('course');
    let session1 = store.createRecord('session', {
      course: course1
    });
    let offering1 = store.createRecord('offering', {
      session: session1
    });
    let offering2 = store.createRecord('offering', {
      session: session1
    });
    store.createRecord('learnerGroup', {
      offerings: [offering1, offering2],
      users: [model]
    });
    let course2 = store.createRecord('course');
    let session2 = store.createRecord('session', {
      course: course2
    });
    let offering3 = store.createRecord('offering', {
      session: session2
    });
    store.createRecord('learnerGroup', {
      offerings: [offering3],
      users: [model]
    });
    
    let courses = [course1, course2];
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
      });
    });
  });
  
});

test('gets all instructor group courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  Ember.run(()=>{
    let course1 = store.createRecord('course');
    let session1 = store.createRecord('session', {
      course: course1
    });
    let offering1 = store.createRecord('offering', {
      session: session1
    });
    let offering2 = store.createRecord('offering', {
      session: session1
    });
    store.createRecord('instructorGroup', {
      offerings: [offering1, offering2],
      users: [model]
    });
    let course2 = store.createRecord('course');
    let session2 = store.createRecord('session', {
      course: course2
    });
    let offering3 = store.createRecord('offering', {
      session: session2
    });
    store.createRecord('instructorGroup', {
      offerings: [offering3],
      users: [model]
    });
    
    let courses = [course1, course2];
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
      });
    });
  });
  
});

test('gets all instructed offering courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  Ember.run(()=>{
    let course1 = store.createRecord('course');
    let session1 = store.createRecord('session', {
      course: course1
    });
    store.createRecord('offering', {
      session: session1,
      instructors: [model]
    });
    store.createRecord('offering', {
      session: session1,
      instructors: [model]
    });
    let course2 = store.createRecord('course');
    let session2 = store.createRecord('session', {
      course: course2
    });
    store.createRecord('offering', {
      session: session2,
      instructors: [model]
    });
    
    let courses = [course1, course2];
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
      });
    });
  });
  
});

test('gets all learner offering courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  Ember.run(()=>{
    let course1 = store.createRecord('course');
    let session1 = store.createRecord('session', {
      course: course1
    });
    store.createRecord('offering', {
      session: session1,
      users: [model]
    });
    store.createRecord('offering', {
      session: session1,
      users: [model]
    });
    let course2 = store.createRecord('course');
    let session2 = store.createRecord('session', {
      course: course2
    });
    store.createRecord('offering', {
      session: session2,
      users: [model]
    });
    
    let courses = [course1, course2];
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));<commit_msg>Fix test mocks for offering learner relationship<commit_after>import {
  moduleForModel,
  test
} from 'ember-qunit';
import Ember from 'ember';
import modelList from '../../helpers/model-list';

moduleForModel('user', 'User', {
  needs: modelList
});

test('it exists', function(assert) {
  var model = this.subject();
  // var store = this.store();
  assert.ok(!!model);
});

test('gets all directed courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  let courses = [];
  Ember.run(()=>{
    courses.pushObject(store.createRecord('course', {
      directors: [model]
    }));
    courses.pushObject(store.createRecord('course', {
      directors: [model]
    }));
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
      });
    });
  });
  
});

test('gets all learner group courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  Ember.run(()=>{
    let course1 = store.createRecord('course');
    let session1 = store.createRecord('session', {
      course: course1
    });
    let offering1 = store.createRecord('offering', {
      session: session1
    });
    let offering2 = store.createRecord('offering', {
      session: session1
    });
    store.createRecord('learnerGroup', {
      offerings: [offering1, offering2],
      users: [model]
    });
    let course2 = store.createRecord('course');
    let session2 = store.createRecord('session', {
      course: course2
    });
    let offering3 = store.createRecord('offering', {
      session: session2
    });
    store.createRecord('learnerGroup', {
      offerings: [offering3],
      users: [model]
    });
    
    let courses = [course1, course2];
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
      });
    });
  });
  
});

test('gets all instructor group courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  Ember.run(()=>{
    let course1 = store.createRecord('course');
    let session1 = store.createRecord('session', {
      course: course1
    });
    let offering1 = store.createRecord('offering', {
      session: session1
    });
    let offering2 = store.createRecord('offering', {
      session: session1
    });
    store.createRecord('instructorGroup', {
      offerings: [offering1, offering2],
      users: [model]
    });
    let course2 = store.createRecord('course');
    let session2 = store.createRecord('session', {
      course: course2
    });
    let offering3 = store.createRecord('offering', {
      session: session2
    });
    store.createRecord('instructorGroup', {
      offerings: [offering3],
      users: [model]
    });
    
    let courses = [course1, course2];
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
      });
    });
  });
  
});

test('gets all instructed offering courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  Ember.run(()=>{
    let course1 = store.createRecord('course');
    let session1 = store.createRecord('session', {
      course: course1
    });
    store.createRecord('offering', {
      session: session1,
      instructors: [model]
    });
    store.createRecord('offering', {
      session: session1,
      instructors: [model]
    });
    let course2 = store.createRecord('course');
    let session2 = store.createRecord('session', {
      course: course2
    });
    store.createRecord('offering', {
      session: session2,
      instructors: [model]
    });
    
    let courses = [course1, course2];
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
      });
    });
  });
  
});

test('gets all learner offering courses', function(assert) {
  let model = this.subject();
  let store = this.store();
  Ember.run(()=>{
    let course1 = store.createRecord('course');
    let session1 = store.createRecord('session', {
      course: course1
    });
    store.createRecord('offering', {
      session: session1,
      learners: [model]
    });
    store.createRecord('offering', {
      session: session1,
      learners: [model]
    });
    let course2 = store.createRecord('course');
    let session2 = store.createRecord('session', {
      course: course2
    });
    store.createRecord('offering', {
      session: session2,
      learners: [model]
    });
    
    let courses = [course1, course2];
    model.get('allRelatedCourses').then(allRelatedCourses => {
      assert.equal(allRelatedCourses.length, courses.length);
      courses.forEach(course => {
        assert.ok(allRelatedCourses.contains(course));
{'fraction_non_alphanumeric': 0.15386111651429682, 'fraction_numerical': 0.01089282240809181, 'mean_word_length': 3.0919220055710306, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, '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': '5262386', 'n_tokens_mistral': 3098, 'n_tokens_neox': 3087, 'n_words': 577}