Ejemplo n.º 1
0
 app.get('/', function (req, res) {
     expect(req.headers['user-agent']).toMatch(/iphone/i);
     expect(req.headers['host']).toMatch(/localhost/);
     expect(req.headers['origin']).toMatch(/localhost/);
     expect(req.headers['referer']).toMatch(/localhost/);
     res.send('ok');
 });
Ejemplo n.º 2
0
 .try(function (ret1, ret2, ret3, ret4) {
     expect(ret1).toBe(1);
     expect(ret2).toBe(2);
     expect(ret3).toBe(3);
     expect(ret4).toBe(4);
     done();
 });
Ejemplo n.º 3
0
 app.get('/', function (req, res) {
     expect(req.headers['user-agent']).toEqual('a');
     expect(req.headers['host']).toEqual('b');
     expect(req.headers['origin']).toEqual('c');
     expect(req.headers['referer']).toEqual('d');
     res.send('ok');
 });
Ejemplo n.º 4
0
    it('有异步任务没有调 next', function () {
        expect(function () {
            plan.task(function () {

            }).serial();
        }).toThrowError();
    });
Ejemplo n.º 5
0
 .try(function (ret) {
     expect(ret).toBe(undefined);
 });
Ejemplo n.º 6
0
 plan.wait(10).serial(function () {
     expect(called).toBeTruthy();
     done();
 });
Ejemplo n.º 7
0
 plan.wait(10).taskSync(function () {
     expect(called).toBeTruthy();
 }).serial(done);
Ejemplo n.º 8
0
 .catch(function (err) {
     expect(err.message).toMatch(/is 2/);
     expect(times).toBe(0);
     done();
 });
Ejemplo n.º 9
0
 plan.wait(10).serial(function (err) {
     expect(err).toBeNull();
 }).on('planEnd', function (err, ret) {
Ejemplo n.º 10
0
 }, function (err, body) {
     expect(body).toEqual('ok');
     stop();
 });
Ejemplo n.º 11
0
 }, function (err) {
     expect(err).toBeTruthy();
     stop();
 });
Ejemplo n.º 12
0
 }, function (err, buffer) {
     expect(Buffer.isBuffer(buffer)).toBe(true);
     stop();
 });
Ejemplo n.º 13
0
 app.get('/', function (req, res) {
     expect(req.query.a).toEqual('1');
     expect(req.query.b).toEqual('2');
     res.send('ok');
 });
Ejemplo n.º 14
0
 .taskSync(function () {
     expect(ret1).toBe(1);
     expect(ret2).toBe(undefined);
 })
Ejemplo n.º 15
0
                    .end(function (err, res) {
                        if (err) throw err;

                        expect(res.text).toEqual('AaA');
                        next();
                    });
Ejemplo n.º 16
0
 plan.wait(50).serial(function () {
     expect(ret1).toBe(1);
     done();
 });
Ejemplo n.º 17
0
 .catch(function (err) {
     expect(err.message).toBe('3');
     done();
 });
Ejemplo n.º 18
0
 }).on('planEnd', function (err, ret) {
     expect(this.length).toBe(1);
     done();
 });
Ejemplo n.º 19
0
                    .end(function (err, res) {
                        if (err) throw err;

                        expect(res.text).toMatch(/=============================/);
                        next();
                    });
Ejemplo n.º 20
0
 .try(function (ret) {
     expect(ret).toBe(6);
     done();
 });
Ejemplo n.º 21
0
 it('exports', function () {
     expect(index).toEqual('index');
 });