summaryrefslogtreecommitdiff
path: root/spec/frontend_integration/ide/helpers/start.js
blob: 9dc9649e1bfc9a0b8a69b779611ad3a6671e0f49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { TEST_HOST } from 'helpers/test_constants';
import extendStore from '~/ide/stores/extend';
import { IDE_DATASET } from './mock_data';
import { initIde } from '~/ide';

export default (container, { isRepoEmpty = false, path = '' } = {}) => {
  global.jsdom.reconfigure({
    url: `${TEST_HOST}/-/ide/project/gitlab-test/lorem-ipsum${
      isRepoEmpty ? '-empty' : ''
    }/tree/master/-/${path}`,
  });

  const el = document.createElement('div');
  Object.assign(el.dataset, IDE_DATASET);
  container.appendChild(el);
  return initIde(el, { extendStore });
};