message: added test helper to render a card in a space (allows links.self to be generated)
diff: import hbs from 'htmlbars-inline-precompile';
  +import qs from 'qs';
  import { render, getContext } from '@ember/test-helpers';
  import { htmlSafe } from '@ember/string';
  +import { pluralize } from 'ember-inflector';
  // This is a workaround for https://github.com/intercom/ember-href-to/issues/94
  // We use href-to internally in cardstack-url. So if you want to generate a link
  @@ -15,6 +17,10 @@ export function findCard(type, id, format='isolated') {
  return getContext().owner.lookup('service:cardstackData').load(type, id, format);
  }
  +export function getSpaceForCard(type, id) {
  + return getContext().owner.lookup('service:store').findRecord('space', `/${pluralize(type)}/${id}`);
  +}
  +
  export function renderCard(type, id, format, options = {}) {
  return findCard(type, id, format).then(card => {
  let context = getContext();
  @@ -32,3 +38,26 @@ export function renderCard(type, id, format, options = {}) {
  }
  });
  }
  +
  +export function renderCardInSpace(type, id, format, options = {}) {
  + return getSpaceForCard(type, id).then(space => {
  + let context = getContext();
  + let card = space.get('primaryCard');
  + let queryParamsString = space.get('queryParams');
  + context.set('card', card);
  + context.set('format', format);
  + if (queryParamsString) {
  + context.set('params', qs.parse(queryParamsString.replace('?', '')));
  + }
  +
  + if (options.width) {
  + context.set('widthStyle', htmlSafe(`width: ${options.width}`));
  + return render(hbs`
  + <div style="{{widthStyle}}">
  + {{cardstack-content event-isolated content=card format=format params=params }}
  + </div>`);
  + } else {
  + return render(hbs`{{cardstack-content event-isolated content=card format=format params=params }}`);
  + }
  + });
  +}
  \ No newline at end of file
  