Exemple #1
0
		it( 'should return true when post.status is pending', function() {
			assert( postUtils.isPending( { status: 'pending' } ) );
		} );
Exemple #2
0
 client.on("error", function(e){
     assert(e.message === "cannot send frame on closed stream");
     done();
 });
Exemple #3
0
 .on('data', function(data) {
   assert(data instanceof AudioBuffer);
   done();
 });
Exemple #4
0
var fail = function(){assert(false);};
Exemple #5
0
 client.on("finish", function(){
     finished = true;
     assert(!ended);
 });
Exemple #6
0
 setupTransaction(function(transaction){
    assert(transaction.id === 1);
    done();
 });
Exemple #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();
 });
 bot.dig(bot.blockAt(bot.entity.position.plus(new Vec3(1, 0, 0))), function(err) {
   assert(!err);
   cb();
 });
Exemple #9
0
var checkerr = function(err) {
    assert(!err, err);
};
Exemple #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);
    });
Exemple #12
0
		it( 'should return false when status !== future', function() {
			assert( ! postUtils.isBackDatedPublished( { status: 'draft' } ) );
		} );
Exemple #13
0
		it( 'should return false when no post is supplied', function() {
			assert( ! postUtils.isBackDatedPublished() );
		} );
Exemple #14
0
		it( 'should return false when post.status is not pending', function() {
			assert( ! postUtils.isPending( { status: 'draft' } ) );
		} );
Exemple #15
0
 server._unsubscribe = function(){assert(false);};
Exemple #16
0
 q2.on('complete', function() {
     assert(!calledq2);
     calledq2 = true;
     setTimeout(checkdone, 10);
 });
Exemple #17
0
 client.connect("localhost", function(){
     assert(serverConnected);
     assert(clientConnected);
     done();
 });
Exemple #18
0
 harness.getClient().flushall(function(err) { assert(!err); done(); });
Exemple #19
0
 server._send = function(frame){
     assert(frame.headers["transaction"] === 1 || frame.headers["transaction"] === "1");
     done();
 };
Exemple #20
0
 stream.on('end', () => {
   assert(data_count > 0, 'emitted \'data\'')
   assert(hit_count === 1, 'emitted EXAMPLE_FEED_1')
   t.end()
 })
Exemple #21
0
 server._commit = function(frame){
     assert(frame.headers["transaction"] === "1");
     done();
 };
Exemple #22
0
 frame.on("end", function(){
     beforeSendResponse();
     assert(writable.getWrittenSlice().toString() === "abcdefgh");
     done();
 });
Exemple #23
0
 server._disconnect = function(frame, beforeSendResponse){
     beforeSendResponse();
     assert(frame.headers.hasOwnProperty("receipt"));
     done();
 };
Exemple #24
0
 client.once("error", function(exception){
     assert(exception instanceof Error);
     assert(exception.message === "test message");
     done();
 });
Exemple #25
0
 client.on("end", function(){
     ended = true;
     assert(finished);
     done();
 });
Exemple #26
0
 client.on("error", function(){assert(false);});
Exemple #27
0
 .on('data', function(chunk) {
   assert(chunk instanceof Buffer);
   done();
 });
Exemple #28
0
 client.once("error", function(exception){
     assert(exception.message === "Protocol error: unknown command 'FOIDSUF'");
     done();
 });
Exemple #29
0
 pub.close(function(){
   assert(n === 3);
   done();
 });
Exemple #30
0
		it( 'should return undefined when no post is supplied', function() {
			assert( postUtils.isPending() === undefined );
		} );