Example #1
0
		it( 'should return true when post.status is pending', function() {
			assert( postUtils.isPending( { status: 'pending' } ) );
		} );
Example #2
0
 client.on("error", function(e){
     assert(e.message === "cannot send frame on closed stream");
     done();
 });
Example #3
0
 .on('data', function(data) {
   assert(data instanceof AudioBuffer);
   done();
 });
Example #4
0
var fail = function(){assert(false);};
Example #5
0
 client.on("finish", function(){
     finished = true;
     assert(!ended);
 });
Example #6
0
 setupTransaction(function(transaction){
    assert(transaction.id === 1);
    done();
 });
Example #7
0
 setupTransaction(function(transaction){
     var frame = transaction.send({destination:"/abc"});
     assert(frame.command === "SEND");
     assert(frame.headers["transaction"] === 1 || frame.headers["transaction"] === "1");
     frame.end();
 });
Example #8
0
 bot.dig(bot.blockAt(bot.entity.position.plus(new Vec3(1, 0, 0))), function(err) {
   assert(!err);
   cb();
 });
Example #9
0
var checkerr = function(err) {
    assert(!err, err);
};
Example #10
0
		it( 'should return true when status === future and date is in the past', function() {
			const tenMinutes = 1000 * 60;
			const postDate = Date.now() - tenMinutes;

			assert( postUtils.isBackDatedPublished( { status: 'future', date: postDate } ) );
		} );
    waitsForPromise(async () => {
      invariant(typeRegistry);

      // {kind: 'bork'; n: number }
      const o1: ObjectType = {
        location: builtinLocation,
        kind: 'object',
        fields: [
          {
            location: builtinLocation,
            type: a1,
            name: 'kind',
            optional: false,
          },
          {
            location: builtinLocation,
            type: numberType,
            name: 'n',
            optional: false,
          },
        ],
      };

      // {kind: 'bork!'; s: string }
      const o2: ObjectType = {
        location: builtinLocation,
        kind: 'object',
        fields: [
          {
            location: builtinLocation,
            type: a2,
            name: 'kind',
            optional: false,
          },
          {
            location: builtinLocation,
            type: stringType,
            name: 's',
            optional: false,
          },
        ],
      };

      // {kind: 42; b: boolean }
      const o3: ObjectType = {
        location: builtinLocation,
        kind: 'object',
        fields: [
          {
            location: builtinLocation,
            type: a3,
            name: 'kind',
            optional: false,
          },
          {
            location: builtinLocation,
            type: booleanType,
            name: 'b',
            optional: false,
          },
        ],
      };

      const type = {
        location: builtinLocation,
        kind: 'union',
        types: [o1, o2, o3],
        discriminantField: 'kind',
      };

      const data1 = {kind: 'bork', n: 42};
      const result1 = await typeRegistry.unmarshal(await typeRegistry.marshal(data1, type), type);
      expect(result1).toEqual(data1);

      const data2 = {kind: 'bork!', s: 'hello'};
      const result2 = await typeRegistry.unmarshal(await typeRegistry.marshal(data2, type), type);
      expect(result2).toEqual(data2);

      const data3 = {kind: 42, b: true};
      const result3 = await typeRegistry.unmarshal(await typeRegistry.marshal(data3, type), type);
      expect(result3).toEqual(data3);

      // Ensure no extra fields are accidentally marshalled.
      const data4 = {kind: 'bork', n: 42, s: 'hello', b: true};
      const result4 = await typeRegistry.unmarshal(await typeRegistry.marshal(data4, type), type);
      expect(result4).toEqual(data1);

      const data5 = {kind: 'not bork!'};
      let thrown = false;
      try {
        await typeRegistry.marshal(data5, type);
      } catch (e) {
        thrown = true;
      }
      expect(thrown).toBe(true);
    });
Example #12
0
		it( 'should return false when status !== future', function() {
			assert( ! postUtils.isBackDatedPublished( { status: 'draft' } ) );
		} );
Example #13
0
		it( 'should return false when no post is supplied', function() {
			assert( ! postUtils.isBackDatedPublished() );
		} );
Example #14
0
		it( 'should return false when post.status is not pending', function() {
			assert( ! postUtils.isPending( { status: 'draft' } ) );
		} );
Example #15
0
 server._unsubscribe = function(){assert(false);};
Example #16
0
 q2.on('complete', function() {
     assert(!calledq2);
     calledq2 = true;
     setTimeout(checkdone, 10);
 });
Example #17
0
 client.connect("localhost", function(){
     assert(serverConnected);
     assert(clientConnected);
     done();
 });
Example #18
0
 harness.getClient().flushall(function(err) { assert(!err); done(); });
Example #19
0
 server._send = function(frame){
     assert(frame.headers["transaction"] === 1 || frame.headers["transaction"] === "1");
     done();
 };
Example #20
0
 stream.on('end', () => {
   assert(data_count > 0, 'emitted \'data\'')
   assert(hit_count === 1, 'emitted EXAMPLE_FEED_1')
   t.end()
 })
Example #21
0
 server._commit = function(frame){
     assert(frame.headers["transaction"] === "1");
     done();
 };
Example #22
0
 frame.on("end", function(){
     beforeSendResponse();
     assert(writable.getWrittenSlice().toString() === "abcdefgh");
     done();
 });
Example #23
0
 server._disconnect = function(frame, beforeSendResponse){
     beforeSendResponse();
     assert(frame.headers.hasOwnProperty("receipt"));
     done();
 };
Example #24
0
 client.once("error", function(exception){
     assert(exception instanceof Error);
     assert(exception.message === "test message");
     done();
 });
Example #25
0
 client.on("end", function(){
     ended = true;
     assert(finished);
     done();
 });
Example #26
0
 client.on("error", function(){assert(false);});
Example #27
0
 .on('data', function(chunk) {
   assert(chunk instanceof Buffer);
   done();
 });
Example #28
0
 client.once("error", function(exception){
     assert(exception.message === "Protocol error: unknown command 'FOIDSUF'");
     done();
 });
Example #29
0
 pub.close(function(){
   assert(n === 3);
   done();
 });
Example #30
0
		it( 'should return undefined when no post is supplied', function() {
			assert( postUtils.isPending() === undefined );
		} );