sajaniemi_variable_dataset_large / pool /shard010 /JavaScript /0062754_angular-socket.io-mock.spec.js
Download pool/shard010/JavaScript/0062754_angular-socket.io-mock.spec.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard010/JavaScript/0062754_angular-socket.io-mock.spec.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard010/JavaScript/0062754_angular-socket.io-mock.spec.js
-
curl -L -o 0062754_angular-socket.io-mock.spec.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard010/JavaScript/0062754_angular-socket.io-mock.spec.js
1.28 kB
| /* global expect: false, it: false, describe: false */ | |
| ; | |
| describe('Angular Socket.io Mock',function(){ | |
| var socketFactory; | |
| beforeEach(module('btford.socket-io')) | |
| beforeEach(inject(function(_socketFactory_){ socketFactory = _socketFactory_ })); | |
| it('should be able to listen on an event', function(){ | |
| expect(new socketFactory().on('test-event',function(){})).not.toBe(false) | |
| }); | |
| it('should be able to listen once event', function(){ | |
| expect(new socketFactory().once('test-event',function(){})).not.toBe(false) | |
| }); | |
| it('should be able to emit an event', function(){ | |
| expect(new socketFactory().emit('test-event',{})).not.toBe(false) | |
| }); | |
| it('should be able to receive an event', function(){ | |
| expect(new socketFactory().receive('test-event',{})).not.toBe(false) | |
| }); | |
| it('should be able to acknowledge an emited event only once',function(done){ | |
| var socket = new socketFactory(); | |
| var timesCalled = 0; | |
| socket.emit('test-event',{}, function(resp){ | |
| expect(resp).not.toBe(false); | |
| expect(++timesCalled).toEqual(1); | |
| }); | |
| socket.receive('test-event', {}); | |
| socket.receive('test-event', {}); | |
| setTimeout(function() { // Wait to see if the event was acknowledged twice | |
| done(); | |
| }, 100); | |
| }); | |
| }) | |