/* global __webpack_public_path__ */
import monacoContext from 'monaco-editor/dev/vs/loader';

describe('MonacoLoader', () => {
  it('calls require.config and exports require', () => {
    spyOn(monacoContext.require, 'config');

    const monacoLoader = require('~/repo/monaco_loader'); // eslint-disable-line global-require

    expect(monacoContext.require.config).toHaveBeenCalledWith({
      paths: {
        vs: `${__webpack_public_path__}monaco-editor/vs`, // eslint-disable-line camelcase
      },
    });
    expect(monacoLoader.default).toBe(monacoContext.require);
  });
});

/* global __webpack_public_path__ */

import monacoContext from 'monaco-editor/dev/vs/loader';
import monacoLoader from '~/repo/monaco_loader';

describe('MonacoLoader', () => {
  it('calls require.config and exports require', () => {
    expect(monacoContext.require.getConfig()).toEqual(jasmine.objectContaining({
      paths: {
        vs: `${__webpack_public_path__}monaco-editor/vs`, // eslint-disable-line camelcase
      },
    }));
    expect(monacoLoader).toBe(monacoContext.require);
  });
});

fix monaco loader test to not break with statically analyzed import statements