Questions tagged [ember-cli-mirage]

Ember CLI Mirage is a mock server that lets you easily mock a JSON API.

Ember CLI Mirage is a mock server that lets you easily mock a JSON API. Factories and fixtures can be defined. It allows for pass-through to an existing API, making it useful for developing new features.

See the homepage, and on github.

168 questions
14
votes
1 answer

How to mock binary response in Mirage

Using Mirage i need to mock my GET request which returns data in the form of binary string (the format is gzip). It is my first time using mirage and i don't know if i'm mocking a binary response, should I return a valid value? here is how i mocked…
user5471528
  • 217
  • 2
  • 9
7
votes
2 answers

Relationships with Ember CLI Mirage

I'm new to Ember and I'm trying to create an easy app where I have 2 models, Mountains and Ranges. A range has many mountains while a mountain belongs to a range. I want to create a relationship between them. I've searched through the web but I've…
splunk
  • 6,435
  • 17
  • 58
  • 105
6
votes
2 answers

Ember.JS - 'TypeError: internalModel.getRecord is not a function' when trying to reverse a collection of records

--Using Ember Data 2.7.1-- I am trying to reverse the order of a collection of records without first turning them into an array using toArray(). This collection of objects comes from the promise returned by this.store.findAll('history-item'). I…
6
votes
2 answers

Remove ember-cli-mirage from ember

I am using ember-cli-mirage to serve for requests. As I have my rails api to serve those request, how i shd remove or uninstall ember-cli-mirage from my ember ? If am removing mirage folder, am getting build error !!
Manikandan
  • 1,234
  • 11
  • 18
6
votes
2 answers

Error returning promise from Ember Data

I am working on my first Ember app and got it to display the way I wanted with the route returning a static JSON object from model(): element: { name: "First Element", divisions: [{ name: "First Division", sets: [{name: "Set 1"},{name:…
ed94133
  • 1,477
  • 2
  • 19
  • 40
6
votes
1 answer

How do I create a relationship in ember-cli-mirage?

I'm trying to create Relationships in Ember-Cli-Mirage. Is this possible in a simple way or do I have to use fixtures instead of factories? These would be my models: TASK: export default DS.Model.extend({ taskName: DS.attr('string'), team:…
Benedikt
  • 608
  • 6
  • 27
3
votes
0 answers

Add meta data to ember js mirage data

I am working in an ember-cli project which has Mirage already set up for testing. It may be an older version, miragejs: ^0.1.44 and ember-cli-mirage: ^2.4.0 I have added a feature that relies on data in the meta object, and now all the affected…
UXCODA
  • 1,118
  • 2
  • 18
  • 33
3
votes
1 answer

Ember Mirage not passing model as an ember object

Using the latest Ember (3.2), ember-cli-mirage 0.4.7, ember-cli-qunit 4.3.2, ember-qunit 3.4.1 I'm using ember-cli-mirage to try out frontend testing, I can't get around this error: Uncaught TypeError: template.getProperties is not a function I'm…
a7omiton
  • 1,597
  • 4
  • 34
  • 61
3
votes
1 answer

Is it possible to intercept a non-ajax request in browser?

Is it possible to intercept HTTP requests in browser with JavaScript which aren't done through XMLHttpRequest object (ajax)? I'm mocking an API server with ember-cli-mirage, which is using pretender. I need to add file upload (images) to the app.…
jelhan
  • 6,149
  • 1
  • 19
  • 35
3
votes
1 answer

Testing error responses with ember-cli-mirage

I'm reading through ember-cli-mirage's docs about creating mock responses but can't figure out how to test error responses for the exact same request. For example: test("I can view the users", function() { var users = server.createList('user',…
David
  • 10,418
  • 17
  • 72
  • 122
2
votes
0 answers

MirageJS - How Do You Add "blob://http://localhost" To Whitelist / Passthrough?

I have functionality that takes a local base64 URL for an image and converts it to actual base64 data. To do this, I have to call fetch(), followed by an initialization of new FileReader(). When the browser tries to fetch the local base64 URL (ie.…
Lloyd Banks
  • 35,740
  • 58
  • 156
  • 248
2
votes
0 answers

MirageJS - Whitelist / Pass Through All XHR Endpoints By Default

Out of the box, you have to specifically tell MirageJS which endpoints to mock out and which endpoints to pass through. If your app calls an endpoint that isn't targeted in Mirage's createServer() function, MirageJS will throw an error. Is there a…
Lloyd Banks
  • 35,740
  • 58
  • 156
  • 248
2
votes
2 answers

How to seed models with polymorphic one to one relationship in mirage js?

this is just an example, I understand that you would normally have multiple comments, but for the sake of this example, lets assume that we have following models: models: { blogPost: Model.extend({ comment: belongsTo(), }), …
J Doe
  • 132
  • 7
2
votes
1 answer

mirage.js will not work with sub url paths (only with root path) in angular

Mirage does match defined routes when the backend calls are performed through the root url (localhost:4200/), but when we perform a backend call on a sub page, e.a.: localhost:4200/process, it will not work. When debugging the mirage code it will…
edbras
  • 4,145
  • 9
  • 41
  • 78
2
votes
1 answer

You tried to include 'dasherized-attribute-name' with model:example(1) but no association named 'dasherizedAttributeName' is defined on the model

our app was created using mostly underscores for model attributes and we are having a very difficult time fully implementing mirage as a result. When we try to include a related model that is referenced as an underscore attribute on the model we…
btrude
  • 21
  • 3
1
2 3
11 12