Skip to content

Instantly share code, notes, and snippets.

@jelhan
Created July 28, 2018 17:24
Show Gist options
  • Save jelhan/c70f9095edc4d2608de07ea048e2dee6 to your computer and use it in GitHub Desktop.
Save jelhan/c70f9095edc4d2608de07ea048e2dee6 to your computer and use it in GitHub Desktop.
Bug: ember-cli-mirage factory is ignored if model is created by pluarlized name
import { Factory } from 'ember-cli-mirage';
import { isEmpty } from '@ember/utils';
export default Factory.extend({
title: 'an example post'
});
export default function(server) {
let singular = server.create('post', 1);
let plural = server.create('posts', 1);
console.log('singular', singular.title, singular);
console.log('plural', plural.title, plural);
}
<h1>Bug: ember-cli-mirage factory is ignored if model is created by pluarlized name</h1>
<p>
Code triggering the bug lives in <i>mirage/scenarios/default.js</i>. Please open up your developer console. You will see that the <i>title</i> property for the record created by pluralized model is <i>undefined</i>. Except for that the model is created just fine. Bug seems to only affect factories.
</p>
{
"version": "0.15.0",
"ENV": {
"ember-cli-mirage": {
"enabled": true
}
},
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.2.2",
"ember-template-compiler": "3.2.2",
"ember-testing": "3.2.2"
},
"addons": {
"ember-data": "3.2.0",
"ember-cli-mirage": "0.4.7"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment