Skip to content

Instantly share code, notes, and snippets.

@visualskyrim
visualskyrim / ShowBox.spec.js
Last active August 6, 2017 14:40
Use Enzyme to test React/Redux container - dispatch
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" } });
@visualskyrim
visualskyrim / ShowBox.jsx
Created May 22, 2017 06:41
Use Enzyme to test React/Redux container - Code List 5
expect(component.find("").prop("value")).to.equal("")
@visualskyrim
visualskyrim / ShowBox.2.spec.js
Last active May 22, 2017 12:22
Use Enzyme to test React/Redux container - Code List 4
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);
@visualskyrim
visualskyrim / ShowBox.jsx
Last active August 6, 2017 14:40
Use Enzyme to test React/Redux container - Code List 3
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');
});
});
@visualskyrim
visualskyrim / ShowBox.2.spec.js
Last active May 22, 2017 06:00
Use Enzyme to test React/Redux container - Code List 3 & 4
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("")
});
@visualskyrim
visualskyrim / shallowWithStore.jsx
Created May 22, 2017 05:34
Use Enzyme to test React/Redux container - Code List 2
import { shallow } from 'enzyme';
const shallowWithStore = (component, store) => {
const context = {
store,
};
return shallow(component, { context });
};
export default shallowWithStore;
@visualskyrim
visualskyrim / ShowBox.jsx
Last active August 6, 2017 14:40
Use Enzyme to test React/Redux container - Code List 1
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 || ""
$+h::
GetKeyState, state, s, P ; D if CapsLock is ON or U otherwise.
if state = D
{
if isCancelled != 1
{
isCancelled = 1
Send {Shift down}{Left}{Shift up}
} else {
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
/**
* Created by visualskyrim on 17/01/20.
*/
import org.apache.kafka.common.serialization.StringDeserializer
import org.apache.spark._
import org.apache.spark.streaming._
import org.apache.spark.streaming.kafka010._
import org.apache.spark.streaming.kafka010.LocationStrategies.PreferConsistent
import org.apache.spark.streaming.kafka010.ConsumerStrategies.Subscribe