constructor(props) { super(props); when( () => !props.authStore.info.addressesIsEmpty, () => { this.setAddButton(); }, ); }
describe('ServiceAlertsStore', () => { let server = null; const store = new ServiceAlertsStore(); beforeEach(() => { server = new MockAdapter(axios); }); afterEach(() => { server = null; }); it('fetches active alerts from API', (done) => { server.onGet(/\/api\/alerts\/\s*/).reply(200, stubAlert); store.fetchServiceAlerts(stubService, '5m', stubPreset); when( () => store.alerts.length > 0, () => { expect(store.alerts).to.have.length(1); done(); }); }); });
changeInput(key, value){ //only change input when editCopy is ready otherwise changes might overide when(()=>{ return this.editCopyBook; },()=>{ this.editCopyBook[key] = value; this.changed = true; }); }
componentDidMount() { // First-class citizens for searching this.props.options.serviceName = {isRangeQuery: false, values: this.props.serviceStore.services}; this.props.options.operationName = {isRangeQuery: false, values: []}; this.props.options.traceId = {isRangeQuery: false, values: []}; // Populates serviceName list after async request is finished when(() => this.props.serviceStore.services.length > 0, () => { this.props.options.serviceName.values = this.props.serviceStore.services; this.props.options.operationName.values = []; }); // Checks for operations when a user supplies a new serviceName const serviceName = this.props.uiState.serviceName; if (serviceName && tracesEnabled) { this.props.operationStore.fetchOperations(serviceName, () => { this.props.options.operationName.values = this.props.operationStore.operations; }); } }
describe('LatencyCostStore', () => { let server = null; const store = LatencyCostStore; beforeEach(() => { server = new MockAdapter(axios); }); afterEach(() => { server = null; }); it('fetches latency cost from api', (done) => { server.onGet('/api/trace/traceId/latencyCost').reply(200, ['success']); store.fetchLatencyCost('traceId'); when( () => store.latencyCost.length > 0, () => { expect(store.latencyCost).to.have.length(1); done(); }); }); });
when( () => store.searchResults.length > 0, () => { store.fetchSearchResults({ spanLevelFilters, startTime: 1, endTime: 1 }); when( () => store.searchResults.length > 0, () => { store.fetchSearchResults({ spanLevelFilters, startTime: 1, endTime: 1 }); when( () => store.searchResults.length > 0, () => {
describe('ServiceStore', () => { let server = null; const store = new ServiceStore(); beforeEach(() => { server = new MockAdapter(axios); }); afterEach(() => { server = null; }); it('fetches services off the api', (done) => { server.onGet('/api/services').reply(200, '["test-service"]'); store.fetchServices(); when( () => store.services.length > 0, () => { expect(store.services).to.have.length(1); done(); }); store.fetchServices(); expect(store.services).to.have.length(0); }); });
describe('RawSpanStore', () => { let server = null; const store = new RawSpanStore(); beforeEach(() => { server = new MockAdapter(axios); }); afterEach(() => { server = null; }); it('fetches raw span from the api', (done) => { server.onGet('/api/trace/raw/test-stub/test-span?serviceName=test-service').reply(200, stubSpan); store.fetchRawSpan('test-stub', 'test-span', 'test-service'); when( () => store.rawSpan.length > 0, () => { expect(store.rawSpan).to.have.length(1); done(); }); }); });
describe('RawTraceStore', () => { let server = null; const store = new RawTraceStore(); beforeEach(() => { server = new MockAdapter(axios); }); afterEach(() => { server = null; }); it('fetches traces from the api with a query', (done) => { server.onGet('/api/trace/raw/test-stub').reply(200, stubTrace); store.fetchRawTrace('test-stub'); when( () => store.rawTrace.length > 0, () => { expect(store.rawTrace).to.have.length(1); done(); }); }); });
describe('ServiceGraphStore', () => { let server = null; const store = new ServiceGraphStore(); beforeEach(() => { server = new MockAdapter(axios); }); afterEach(() => { server = null; }); it('fetches service graph from the api', (done) => { server.onGet('/api/serviceGraph?from=1&to=2').reply(200, stubGraph); store.fetchServiceGraph(stubFilter); when( () => store.graphs.length > 0, () => { expect(store.graphs).to.have.length(2); done(); }); }); });
describe('SpansSearchStore', () => { let server = null; const store = new SpansSearchStore(); beforeEach(() => { server = new MockAdapter(axios); }); afterEach(() => { server = null; }); it('fetches individual spans from api with traceIds passed in', (done) => { server.onGet('/api/traces/raw?traceIds=%5B%2212345%22%5D').reply(200, stubTrace); store.fetchSpans(['12345']); when( () => store.results.length > 0, () => { expect(store.results).to.have.length(4); done(); }); }); });
describe('OperationStore', () => { let server = null; const store = new OperationStore(); beforeEach(() => { server = new MockAdapter(axios); }); afterEach(() => { server = null; }); it('fetches operations off the api', (done) => { server.onGet('/api/operations?serviceName=test-service').reply(200, '["test-service"]'); store.fetchOperations('test-service'); when( () => store.operations.length > 0, () => { expect(store.operations).to.have.length(2); done(); }); }); });