This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import PropTypes from 'prop-types' | |
| import { connect } from 'react-redux' | |
| import { submitValue } from '../store/modules/showBox' | |
| export class ShowBox extends React.Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| searchString: this.props.search || "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { shallow } from 'enzyme'; | |
| const shallowWithStore = (component, store) => { | |
| const context = { | |
| store, | |
| }; | |
| return shallow(component, { context }); | |
| }; | |
| export default shallowWithStore; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('ConnectedShowBox', () => { | |
| it("should render a text box with empty string inside if string is not provided by store", () => { | |
| const testState = { | |
| searchBox: {} | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedShowBox />, store); | |
| expect(component).to.be.a('object'); | |
| expect(component.dive().find("").prop("value")).to.equal("") | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('ConnectedShowBox', () => { | |
| it("should render successfully if string is not provided by store", () => { | |
| const testState = { | |
| showBox: {} | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedShowBox />, store); | |
| expect(component).to.be.a('object'); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('ConnectedShowBox', () => { | |
| it("should render a text box with empty string inside if string is not provided by store", () => { | |
| const testState = { | |
| searchBox: { | |
| search: "" | |
| } | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedSearchBox />, store); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| expect(component.find("").prop("value")).to.equal("") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it("should render a text box with no string inside if search string is not provided by store", () => { | |
| const testState = { | |
| showBox: { | |
| search: "" | |
| } | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedShowBox />, store); | |
| component.dive().find("form > div > input").simulate("change", { target: { value: "Site" } }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('ConnectedShowBox', () => { | |
| it("should render a text box with empty string inside if string is not provided by store", () => { | |
| const testState = { | |
| searchBox: {} | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedShowBox />, store); | |
| expect(component).to.be.a('object'); | |
| expect(component.dive().find("").prop("value")).to.equal("") | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it("should render a text box with no string inside if search string is not provided by store", () => { | |
| const testState = { | |
| showBox: { | |
| search: "" | |
| } | |
| }; | |
| const store = createMockStore(testState) | |
| const component = shallowWithStore(<ConnectedShowBox />, store); | |
| expect(component).to.be.a('object'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from kafka import KafkaProducer | |
| from kafka.errors import KafkaError | |
| import json | |
| import time | |
| producer = KafkaProducer(bootstrap_servers=['localhost:9092'], value_serializer=lambda m: json.dumps(m).encode('ascii')) | |
| # Asynchronous by default | |
| future = producer.send('flink-test', b'raw_bytes') | |
| # Block for 'synchronous' sends |