Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(() => {
const sagaMiddleware = createSagaMiddleware();
store = createStore(
({ actionTypes = [] } = {}, { type }) =>
/^DIRECT_LINE\/(DIS|RE)?CONNECT/u.test(type)
? // We are only interested in CONNECT_*, RECONNECT_*, and DISCONNECT_* actions.
{ actionTypes: [...actionTypes, type] }
: { actionTypes },
applyMiddleware(sagaMiddleware)
);
sagaMiddleware.run(connectSaga);
directLine = {
activity$: new Observable(() => () => 0),
connectionStatus$: new Observable(observer => {
connectionStatusObserver = observer;
observer.next(0);
}),
end: () => 0,
postActivity: () =>
new Observable(observer => {
observer.next({ id: '' });
})
};
});
const sagaMiddleware = createSagaMiddleware();
store = createStore(
({ actionTypes = [] } = {}, { type }) =>
/^DIRECT_LINE\/(DIS|RE)?CONNECT/u.test(type)
? // We are only interested in CONNECT_*, RECONNECT_*, and DISCONNECT_* actions.
{ actionTypes: [...actionTypes, type] }
: { actionTypes },
applyMiddleware(sagaMiddleware)
);
sagaMiddleware.run(connectSaga);
directLine = {
activity$: new Observable(() => () => 0),
connectionStatus$: new Observable(observer => {
connectionStatusObserver = observer;
observer.next(0);
}),
end: () => 0,
postActivity: () =>
new Observable(observer => {
observer.next({ id: '' });
})
};
});
constructor() {
super();
this.botConnection = {
connectionStatus$: new Observable(observer => {
observer.next(ConnectionStatus.Uninitialized);
observer.next(ConnectionStatus.Connecting);
observer.next(ConnectionStatus.Online);
}),
activity$: new Observable(observer => {
this.activityObserver = observer;
}),
end() {
// The React component was called to unmount:
// https://github.com/Microsoft/BotFramework-WebChat/blob/57360e4df92e041d5b0fd4810c1abf96621b5283/src/Chat.tsx#L237-L247
// Developers will need to decide what behavior the component should implement.
// For this sample, this.botConnection.componentWillUnmount() and this.botConnection.end()
// is never called.
console.log('this.botConnection.componentWillUnmount() called.');
},
getSessionId: () => new Observable(observer => observer.complete()),
constructor() {
super();
this.botConnection = {
connectionStatus$: new Observable(observer => {
observer.next(ConnectionStatus.Uninitialized);
observer.next(ConnectionStatus.Connecting);
observer.next(ConnectionStatus.Online);
}),
activity$: new Observable(observer => {
this.activityObserver = observer;
}),
end() {
// The React component was called to unmount:
// https://github.com/Microsoft/BotFramework-WebChat/blob/57360e4df92e041d5b0fd4810c1abf96621b5283/src/Chat.tsx#L237-L247
// Developers will need to decide what behavior the component should implement.
// For this sample, this.botConnection.componentWillUnmount() and this.botConnection.end()
// is never called.
console.log('this.botConnection.componentWillUnmount() called.');
},
getSessionId: () => new Observable(observer => observer.complete()),
postActivity: activity => {
const id = Date.now().toString();
return new Observable(observer => {
const serverActivity = {