2020-06-23 00:09:42 +05:30
|
|
|
import extendStore from '~/ide/stores/extend';
|
|
|
|
import terminalPlugin from '~/ide/stores/plugins/terminal';
|
|
|
|
import terminalSyncPlugin from '~/ide/stores/plugins/terminal_sync';
|
|
|
|
|
|
|
|
jest.mock('~/ide/stores/plugins/terminal', () => jest.fn());
|
|
|
|
jest.mock('~/ide/stores/plugins/terminal_sync', () => jest.fn());
|
|
|
|
|
|
|
|
describe('ide/stores/extend', () => {
|
|
|
|
let store;
|
|
|
|
let el;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
store = {};
|
|
|
|
el = {};
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
[terminalPlugin, terminalSyncPlugin].forEach((x) => {
|
2020-06-23 00:09:42 +05:30
|
|
|
const plugin = jest.fn();
|
|
|
|
|
|
|
|
x.mockImplementation(() => plugin);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
terminalPlugin.mockClear();
|
|
|
|
terminalSyncPlugin.mockClear();
|
|
|
|
});
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
const withGonFeatures = (features) => {
|
2023-05-27 22:25:52 +05:30
|
|
|
global.gon.features = features;
|
2020-06-23 00:09:42 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
describe('terminalPlugin', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
extendStore(store, el);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('is created', () => {
|
|
|
|
expect(terminalPlugin).toHaveBeenCalledWith(el);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('is called with store', () => {
|
|
|
|
expect(terminalPlugin()).toHaveBeenCalledWith(store);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('terminalSyncPlugin', () => {
|
|
|
|
describe('when buildServiceProxy feature is enabled', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
withGonFeatures({ buildServiceProxy: true });
|
|
|
|
|
|
|
|
extendStore(store, el);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('is created', () => {
|
|
|
|
expect(terminalSyncPlugin).toHaveBeenCalledWith(el);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('is called with store', () => {
|
|
|
|
expect(terminalSyncPlugin()).toHaveBeenCalledWith(store);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('when buildServiceProxy feature is disabled', () => {
|
|
|
|
it('is not created', () => {
|
|
|
|
extendStore(store, el);
|
|
|
|
|
|
|
|
expect(terminalSyncPlugin).not.toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|