<commit_before>import Orbit from 'orbit/main';
import Schema from 'orbit-common/schema';
import Store from 'orbit-common/store';
import { resolve, Promise } from 'rsvp';
import Transform from 'orbit/transform';
import {
  addRecordOperation,
  replaceRecordOperation,
  removeRecordOperation,
  replaceAttributeOperation,
  addToRelationshipOperation,
  removeFromRelationshipOperation,
  replaceRelationshipOperation
} from 'orbit-common/lib/operations';
import { asyncTest, transformMatching } from 'tests/test-helper';

const stub = sinon.stub;

const schemaDefinition = {
  models: {
    star: {
      attributes: {
        name: {type: 'string'}
      },
      relationships: {
        planets: {type: 'hasMany', model: 'planet', inverse: 'star'}
      }
    },
    planet: {
      attributes: {
        name: {type: 'string'},
        classification: {type: 'string'}
      },
      relationships: {
        moons: {type: 'hasMany', model: 'moon', inverse: 'planet'},
        star: {type: 'hasOne', model: 'star', inverse: 'planets'}
      }
    },
    moon: {
      attributes: {
        name: {type: 'string'}
      },
      relationships: {
        planet: {type: 'hasOne', model: 'planet', inverse: 'moons'}
      }
    }
  }
};

let store,
    schema,
    didTransform;

module('OC - Store', {
  setup() {
    Orbit.Promise = Promise;

    schema = new Schema(schemaDefinition);
    store = new Store({schema});

    didTransform = stub().returns(resolve());
    store.on('didTransform', didTransform);
  },

  teardown() {
    schema = null;
    Orbit.Promise = null;
  }
});
<commit_msg>Fix Store tests to observe `transform` event.<commit_after>import Orbit from 'orbit/main';
import Schema from 'orbit-common/schema';
import Store from 'orbit-common/store';
import { resolve, Promise } from 'rsvp';
import Transform from 'orbit/transform';
import {
  addRecordOperation,
  replaceRecordOperation,
  removeRecordOperation,
  replaceAttributeOperation,
  addToRelationshipOperation,
  removeFromRelationshipOperation,
  replaceRelationshipOperation
} from 'orbit-common/lib/operations';
import { asyncTest, transformMatching } from 'tests/test-helper';

const stub = sinon.stub;

const schemaDefinition = {
  models: {
    star: {
      attributes: {
        name: {type: 'string'}
      },
      relationships: {
        planets: {type: 'hasMany', model: 'planet', inverse: 'star'}
      }
    },
    planet: {
      attributes: {
        name: {type: 'string'},
        classification: {type: 'string'}
      },
      relationships: {
        moons: {type: 'hasMany', model: 'moon', inverse: 'planet'},
        star: {type: 'hasOne', model: 'star', inverse: 'planets'}
      }
    },
    moon: {
      attributes: {
        name: {type: 'string'}
      },
      relationships: {
        planet: {type: 'hasOne', model: 'planet', inverse: 'moons'}
      }
    }
  }
};

let store,
    schema,
    didTransform;

module('OC - Store', {
  setup() {
    Orbit.Promise = Promise;

    schema = new Schema(schemaDefinition);
    store = new Store({schema});

    didTransform = stub().returns(resolve());
    store.on('transform', didTransform);
  },

  teardown() {
    schema = null;
    Orbit.Promise = null;
  }
});

{'fraction_non_alphanumeric': 0.1421492722205017, 'fraction_numerical': 0.0, 'mean_word_length': 2.9583333333333335, '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': '4543864', 'n_tokens_mistral': 984, 'n_tokens_neox': 981, 'n_words': 236}