Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Activate our plugin with the Hadron App Registry
activate(appRegistry);
appRegistry.onActivated();
// Since we are using HtmlWebpackPlugin WITHOUT a template,
// we should create our own root node in the body element before rendering into it.
const root = document.createElement('div');
root.style = 'height: 100vh';
root.id = 'root';
document.body.appendChild(root);
// // Data service initialization and connection.
import Connection from 'mongodb-connection-model';
import DataService from 'mongodb-data-service';
const localAppRegistry = new AppRegistry();
const store = configureStore({
localAppRegistry: localAppRegistry,
globalAppRegistry: appRegistry,
serverVersion: '4.2.0',
fields: [
{ name: 'harry',
value: 'harry',
score: 1,
meta: 'field',
version: '0.0.0' },
{ name: 'potter',
value: 'potter',
score: 1,
meta: 'field',
version: '0.0.0' }
]
import app from 'hadron-app';
import AppRegistry from 'hadron-app-registry';
import { AppContainer } from 'react-hot-loader';
import AggregationsPlugin, { activate, CreateViewPlugin, DuplicateViewPlugin } from 'plugin';
import configureStore, { setDataProvider, setNamespace } from 'stores';
import configureCreateViewStore from 'stores/create-view';
import ExportToLanguagePlugin, {
configureStore as configureExportToLangStore
} from '@mongodb-js/compass-export-to-language';
// Import global less file. Note: these styles WILL NOT be used in compass, as compass provides its own set
// of global styles. If you are wishing to style a given component, you should be writing a less file per
// component as per the CSS Modules ICSS spec. @see src/components/toggle-button for an example.
import 'less/global.less';
const appRegistry = new AppRegistry();
global.hadronApp = app;
global.hadronApp.appRegistry = appRegistry;
// Activate our plugin with the Hadron App Registry
activate(appRegistry);
appRegistry.onActivated();
// Since we are using HtmlWebpackPlugin WITHOUT a template,
// we should create our own root node in the body element before rendering into it.
const root = document.createElement('div');
root.style = 'height: 100vh';
root.id = 'root';
document.body.appendChild(root);
// // Data service initialization and connection.
describe('DuplicateViewStore [Store]', () => {
const appRegistry = new AppRegistry();
before(() => {
store.onActivated(appRegistry);
});
describe('#onActivated', () => {
context('when the data-service-connected event is emitted', () => {
beforeEach(() => {
appRegistry.emit('data-service-connected', null, 'testing');
});
it('dispatches the data service connected action', () => {
expect(store.getState().dataService.dataService).to.equal('testing');
});
});
describe('#onActivated', () => {
let store;
const localAppRegistry = new AppRegistry();
const globalAppRegistry = new AppRegistry();
beforeEach(() => {
store = configureStore({
localAppRegistry: localAppRegistry,
globalAppRegistry: globalAppRegistry
});
});
context('when the fields change', () => {
it('updates the fields', (done) => {
const unsubscribe = store.subscribe(() => {
unsubscribe();
expect(store.getState().fields).to.deep.equal([
{
name: 'harry',
context('when providing an app registry', () => {
let store;
const localAppRegistry = new AppRegistry();
const globalAppRegistry = new AppRegistry();
beforeEach(() => {
store = configureStore({
localAppRegistry: localAppRegistry,
globalAppRegistry: globalAppRegistry
});
});
it('sets the app registry the state', () => {
expect(store.getState().appRegistry).to.deep.equal({
localAppRegistry: localAppRegistry,
globalAppRegistry: globalAppRegistry
});
});
});
context('when providing an app registry', () => {
let store;
const localAppRegistry = new AppRegistry();
const globalAppRegistry = new AppRegistry();
beforeEach(() => {
store = configureStore({
localAppRegistry: localAppRegistry,
globalAppRegistry: globalAppRegistry
});
});
it('sets the app registry the state', () => {
expect(store.getState().appRegistry).to.deep.equal({
localAppRegistry: localAppRegistry,
globalAppRegistry: globalAppRegistry
});
});
});
describe('CreateViewStore [Store]', () => {
let store;
const appRegistry = new AppRegistry();
const ds = 'data-service';
beforeEach(() => {
store = configureStore({
localAppRegistry: appRegistry,
dataProvider: {
error: null,
dataProvider: ds
}
});
});
afterEach(() => {
store = null;
});