Blame view

node_modules/continuation-local-storage/test/async-no-run-queue-multiple.tap.js 627 Bytes
f7563de62   Palak Handa   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  var test = require('tap').test
    , cls  = require('../context.js')
    ;
  
  test("minimized test case that caused #6011 patch to fail", function (t) {
    t.plan(3);
  
    console.log('+');
    // when the flaw was in the patch, commenting out this line would fix things:
    process.nextTick(function () { console.log('!'); });
  
    var n = cls.createNamespace("test");
    t.ok(!n.get('state'), "state should not yet be visible");
  
    n.run(function () {
      n.set('state', true);
      t.ok(n.get('state'), "state should be visible");
  
      process.nextTick(function () {
        t.ok(n.get('state'), "state should be visible");
      });
    });
  });