test("test watch", () => {
  const am = genAM();
  const spy1 = sinon.spy();
  const spy2 = sinon.spy();
  am.addAttribute(genAttr(NSIdentity.fromFQN("hoge.aaa"), () => {
    spy1("watch");
  }));
  am.addAttribute(genAttr(NSIdentity.fromFQN("hoge.aaa"), () => {
    spy2("watch");
  }));
  am.watch(NSIdentity.guess("hoge.aaa"), (a, b, c) => { /*do nothing*/ });
  sinon.assert.called(spy1);
  sinon.assert.called(spy2);
});
    test('calls indices.delete', async () => {
      const callCluster = sinon.spy(async (path: string, { index }: any) => {
        expect(path).toEqual('indices.delete');
        expect(index).toEqual('.lotr');
      });

      await Index.deleteIndex(callCluster, '.lotr');
      sinon.assert.called(callCluster);
    });
Example #3
0
    test('calls indices.create', async () => {
      const callCluster = sinon.spy(async (path: string, { body, index }: any) => {
        expect(path).toEqual('indices.create');
        expect(body).toEqual({ mappings: { foo: 'bar' } });
        expect(index).toEqual('.abcd');
      });

      await Index.createIndex(callCluster, '.abcd', { foo: 'bar' } as any);
      sinon.assert.called(callCluster);
    });
Example #4
0
test("Broadcast message with range should work correctly", (t) => {
  const testNode3 = rootNode.children[0];
  resetSpies();
  testNode3.enabled = true;
  rootNode.broadcastMessage(1, "onTest");
  sinon.assert.called(testComponent3Spy);
  sinon.assert.notCalled(testComponent2Spy);
  sinon.assert.notCalled(testComponentOptionalSpy);
  sinon.assert.notCalled(testComponent1Spy);
});
    test('calls indices.create', async () => {
      const callCluster = sinon.spy(async (path: string, { body, index }: any) => {
        expect(path).toEqual('indices.create');
        expect(body).toEqual({
          mappings: { foo: 'bar' },
          settings: { auto_expand_replicas: '0-1', number_of_shards: 1 },
        });
        expect(index).toEqual('.abcd');
      });

      await Index.createIndex(callCluster, '.abcd', { foo: 'bar' } as any);
      sinon.assert.called(callCluster);
    });
    test('it calls indices.putMapping', async () => {
      const callCluster = sinon.spy(async (path: string, { body, type, index }: any) => {
        expect(path).toEqual('indices.putMapping');
        expect(index).toEqual('.shazm');
        expect(body).toEqual({
          dynamic: 'strict',
          properties: {
            foo: 'bar',
          },
        });
      });

      await Index.putMappings(callCluster, '.shazm', {
        dynamic: 'strict',
        properties: {
          foo: 'bar',
        },
      });

      sinon.assert.called(callCluster);
    });
 it("enableCircularCheck option is true", () => {
     const result = plainToClass<User, Object>(User, user, { enableCircularCheck: true }); 
     sinon.assert.called(isCircularSpy);
 });
Example #8
0
 setTimeout(() => {
   sinon.assert.called(postStub);
 }, ReportingLoopIntervalInMs + 100);