it('Produces new session when query changes', async () => {

        assert.isUndefined(routingStore._session);

        routingStore.urlLengthThresholdForSession = 4;

        routingStore.updateRoute({
            param1: undefined,
            param2: 'altered',
            param3: 'new'
        });

        assert.isDefined(routingStore._session);
        assert.isDefined(routingStore.location.query.session_id);

        await sleep(0);

        assert.equal(routingStore.location.query.session_id, 'somekey','we have non-pending session_id');

        saveRemoteSessionStub.returns(Promise.resolve({id:'monkeys'}));

        // now change route again
        routingStore.updateRoute({
            param1: undefined,
            param2: 'blah',
            param3: 'another'
        });

        assert.equal(routingStore.location.query.session_id, 'pending', 'goes to pending');

        await sleep(0);

        assert.equal(routingStore.location.query.session_id, 'monkeys','we have a new session id');

    });
  test('resolves the Polymer.Base class', async () => {
    // This directory contains files copied from Polymer 1.x core.
    const analyzer = Analyzer.createForDirectory(
        path.resolve(fixtureDir, 'polymer-core-feature/'));

    const analysis = await analyzer.analyzePackage();
    const features = analysis.getFeatures({id: 'Polymer.Base', kind: 'class'});
    assert.equal(features.size, 1);
    const polymerBase = features.values().next().value;
    assert.equal(polymerBase.methods.size, 35);
    assert.equal(polymerBase.properties.size, 2);

    // A method from debounce.html
    const debounce = polymerBase.methods.get('debounce');
    assert.isDefined(debounce);
    assert.equal(debounce!.privacy, 'public');
    assert.equal(debounce!.params![0].name, 'jobName');

    // A method from base.html
    const addFeature = polymerBase.methods.get('_addFeature');
    assert.isDefined(addFeature);
    assert.equal(addFeature!.privacy, 'protected');

    // A property from behaviors.html
    const behaviors = polymerBase.properties.get('behaviors');
    assert.isDefined(behaviors);
  });
    it('Restores non-session behavior', () => {

        assert.isUndefined(routingStore._session);

        routingStore.urlLengthThresholdForSession = 4;

        routingStore.updateRoute({
            param1: undefined,
            param2: 'altered',
            param3: 'new'
        });

        assert.isDefined(routingStore._session);
        assert.isDefined(routingStore.location.query.session_id);

        routingStore.updateRoute({
            param1: undefined,
            param2: 'altered',
            param3: 'new'
        },'/notEnabled');

        assert.deepEqual(mobx.toJS(routingStore.location.query),{ param2:'altered', param3:'new'}, 'using url again');
        assert.isUndefined(routingStore.location.query.session_id);

    });
Пример #4
0
 it("should correctly dispatch receiveMetrics", function() {
   let response = new protos.cockroach.ts.TimeSeriesQueryResponse({
     results: [
       {
         datapoints: [],
       },
     ],
   });
   let request = new protos.cockroach.ts.TimeSeriesQueryRequest({
     start_nanos: Long.fromInt(0),
     end_nanos: Long.fromInt(10),
     queries: [
       {
         name: "test.metric.1",
       },
     ],
   });
   state = reducer(state, metrics.receiveMetrics(componentID, request, response));
   assert.isDefined(state.queries);
   assert.isDefined(state.queries[componentID]);
   assert.lengthOf(_.keys(state.queries), 1);
   assert.equal(state.queries[componentID].data, response);
   assert.equal(state.queries[componentID].request, request);
   assert.isUndefined(state.queries[componentID].nextRequest);
   assert.isUndefined(state.queries[componentID].error);
 });
Пример #5
0
 it("should correctly dispatch errorMetrics", function() {
   let error: Error = new Error("An error occurred");
   state = reducer(state, metrics.errorMetrics(componentID, error));
   assert.isDefined(state.queries);
   assert.isDefined(state.queries[componentID]);
   assert.lengthOf(_.keys(state.queries), 1);
   assert.equal(state.queries[componentID].error, error);
   assert.isUndefined(state.queries[componentID].request);
   assert.isUndefined(state.queries[componentID].data);
 });
Пример #6
0
    it('basic', function () {
      assert.isDefined(Store);
      assert.isFunction(Store);

      var instance = new Store();
      assert.isDefined(instance);
      assert.isObject(instance);
      assert.isDefined(instance._type);
      assert.isString(instance._type);
      assert.equal(instance._type, 'Relution.livedata.Store');
    })
Пример #7
0
    it('basic', function () {
      assert.isDefined(Collection);
      assert.isFunction(Collection);

      var instance = new Collection();
      assert.isDefined(instance);
      assert.isObject(instance);
      assert.isDefined(instance._type);
      assert.isString(instance._type);
      assert.equal(instance._type, 'Relution.livedata.Collection');
    }),
Пример #8
0
 it("default", () => {
     const resolver = new CommandLine({ options: { } });
     assert.isUndefined(resolver.getDefaultGroup());
     assert.isUndefined(resolver.getPassthruOption());
     assert.isUndefined(resolver.getRestOption());
     assert.isDefined(resolver.getHelpOption());
     assert.deepEqual(resolver.groups, []);
     assert.isDefined(resolver.fromShortName("?"));
     assert.isDefined(resolver.fromShortName("h"));
     assert.isDefined(resolver.fromLongName("help"));
 });
Пример #9
0
    it('basic', function () {
      assert.isDefined(Model);
      assert.isFunction(Model);

      var instance = new Model();
      assert.isDefined(instance);
      assert.isObject(instance);
      assert.isDefined(instance._type);
      assert.isString(instance._type);
      assert.equal(instance._type, 'Relution.livedata.Model');
    }),
        it("should find elements", async () => {
            firstButton = await driver.findElementByAutomationText("Toggle first");
            secondButton = await driver.findElementByAutomationText("Toggle second");

            firstLabel = await driver.findElementByAutomationText("== 1 ==");
            secondLabel = await driver.findElementByAutomationText("== 2 ==");

            assert.isDefined(firstButton);
            assert.isDefined(secondButton);
            assert.isDefined(firstLabel);
            assert.isDefined(secondLabel);
        });