Files
meteor/packages/context/context-tests.js
Ben Newman 664560d8bb Implement basic meteor/context package with @wry/context.
The promise package needs a weak dependency on this package (on the
server) because meteor-promise saves a reference to Fiber.yield, so we
need to have wrapped Fiber.yield with noContext before that happens.
2019-04-12 16:12:51 -04:00

13 lines
365 B
JavaScript

import { Tinytest } from "meteor/tinytest";
import { Slot } from "meteor/context";
Tinytest.add('context - basic Slot usage', function (test) {
const slot = new Slot();
test.equal(slot.hasValue(), false);
slot.withValue(123, () => {
test.equal(slot.hasValue(), true);
test.equal(slot.getValue(), 123);
});
test.equal(slot.hasValue(), false);
});