Пример #1
0
 it('can compile a number matcher', () => {
   let match = compileMatcher(3);
   let ctx = new Context();
   assert.ok(match(3, ctx));
   assert.notOk(match(1, ctx));
   assert.notOk(match('3', ctx));
 });
Пример #2
0
 it('can compile a string matcher', () => {
   let match = compileMatcher('5');
   let ctx = new Context();
   assert.ok(match('5', ctx));
   assert.notOk(match('hello', ctx));
   assert.notOk(match(5, ctx));
 });
Пример #3
0
 it('can compile a null matcher', () => {
   let match = compileMatcher(null);
   let ctx = new Context();
   assert.ok(match(null, ctx));
   assert.notOk(match(undefined, ctx));
   assert.notOk(match(false, ctx));
 });
Пример #4
0
 it('can compile a boolean matcher', () => {
   let match = compileMatcher(false);
   let ctx = new Context();
   assert.ok(match(false, ctx));
   assert.notOk(match(true, ctx));
   assert.notOk(match(null, ctx));
 });
Пример #5
0
 it("should delete data without a callback", async () => {
   let result = await bucket.get(key);
   assert.deepEqual(result, value);
   await bucket.del(key);
   result = await bucket.get(key);
   assert.notOk(result);
 });
Пример #6
0
 it("getdel()", async () => {
   await bucket.set(key, value);
   let result = await bucket.getdel(key);
   assert.deepEqual(value, result);
   result = await bucket.get(key);
   assert.notOk(result);
 });
Пример #7
0
 it('exposes simple bindings', () => {
   let context = new Context();
   assert.ok(context.bind('foo', 1));
   assert.ok(context.bind('foo', 1));
   assert.notOk(context.bind('foo', 2));
   assert.deepEqual(flattenPrototype(context.expose()), { foo: 1 });
 });
Пример #8
0
  it('returns nothing when the store is enough', () => {
    const query = gql`
      {
        people_one(id: "1") {
          name
        }
      }
    `;

    const result = {
      people_one: {
        name: 'Luke Skywalker',
      },
    };

    const store = writeQueryToStore({
      result,
      query,
    });

    assert.notOk(diffQueryAgainstStore({
      store,
      query,
    }).isMissing);
  });
Пример #9
0
function assertNoMatch(matcher: (key: string) => Matcher, node: any) {
  let context = new Context();
  assert.notOk(matcher('binding')(node, context));

  let env = flattenPrototype(context.expose());
  assert.deepEqual(env, {});
}
Пример #10
0
 it('attempts to establish the number of processors', () => {
     assert.equal(subject.processorCount, 8);
     
     delete global['navigator'].hardwareConcurrency;
     subject = new UserEnvironment();
     
     assert.notOk(subject.processorCount);
 });