Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mockMessage(msg) {
const pubnubMsg = {
channel: this._channels[0],
subscription: undefined,
actualChannel: null,
subscribedChannel: this._channels[0],
timetoken: '14933652238078468',
publisher: undefined,
message: msg,
};
this._listeners.forEach((l) => l.message(pubnubMsg));
}
}
MockedPubNub.OPERATIONS = RealPubnub.OPERATIONS;
MockedPubNub.CATEGORIES = RealPubnub.CATEGORIES;
export function getLastPubnub() {
return pubnubs[pubnubs.length - 1];
}
function mockPubnub() {
const id = require.resolve('pubnub');
if (require.cache[id]) {
require.cache[id].exports = MockedPubNub;
}
}
mockPubnub();
mockMessage(msg) {
let pubnubMsg = {
channel: this.channels[0],
subscription: undefined,
actualChannel: null,
subscribedChannel: this.channels[0],
timetoken: '14933652238078468',
publisher: undefined,
message: msg
};
this.listeners.forEach(l => l.message(pubnubMsg));
}
static OPERATIONS = RealPubnub.OPERATIONS;
static CATEGORIES = RealPubnub.CATEGORIES;
}
mockPubnub();
export function getLastPubnub() {
return pubnubs[pubnubs.length - 1];
}
function mockPubnub() {
let id = require.resolve('pubnub');
require.cache[id].exports = MockedPubNub;
}