PageRenderTime 38ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/expresso/test/serial/async.test.js

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
JavaScript | 39 lines | 33 code | 6 blank | 0 comment | 0 complexity | 90532286c86a1148caddce42cfd3762d MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. var assert = require('assert')
  2. , setup = 0
  3. , order = [];
  4. module.exports = {
  5. setup: function(done){
  6. ++setup;
  7. done();
  8. },
  9. a: function(done){
  10. assert.equal(1, setup);
  11. order.push('a');
  12. setTimeout(function(){
  13. done();
  14. }, 500);
  15. },
  16. b: function(done){
  17. assert.equal(2, setup);
  18. order.push('b');
  19. setTimeout(function(){
  20. done();
  21. }, 200);
  22. },
  23. c: function(done){
  24. assert.equal(3, setup);
  25. order.push('c');
  26. setTimeout(function(){
  27. done();
  28. }, 1000);
  29. },
  30. d: function(){
  31. assert.eql(order, ['a', 'b', 'c']);
  32. }
  33. };