• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ava.after函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中ava.after函数的典型用法代码示例。如果您正苦于以下问题:TypeScript after函数的具体用法?TypeScript after怎么用?TypeScript after使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了after函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: createTestData

    mongoClient,
    db: mongoClient.db(),
    validate: [
      {
        dir: __dirname,
        fileMatch: 'models.js'
      }
    ]
  });

  await createTestData();
});

// drop test db
test.after(async () => {
  await Tyr.mongoClient.db(sanitizedDB).dropDatabase();
});

test.serial('should successfully sanitize', () =>
  sanitize(Tyr, { outDbName: sanitizedDB })
);

test.serial('should error if sanitizing into same db', async t => {
  try {
    await sanitize(Tyr, { outDbName: sanitizedDB });
  } catch (err) {
    return t.pass();
  }
  t.fail();
});
开发者ID:tyranid-org,项目名称:tyranid,代码行数:30,代码来源:index.ts


示例2: test

    let myArray: Array<any> = ["firstObject", "secondObject", ["nestedObj1", "nestedObj2"]];
    logger.info("Writing default level to default console.");
    logger.debug("writing debug level to default console.");
    logger.warn("Writing array object to default console", myArray);
});

test("Logger with default parameters can be instantiated multiple times", async t => {
    let logger = new Logger();
    logger.info("Writing default level to default console.");
    logger.debug("writing debug level to default console.");

    /* tslint:disable:no-unused-variable */
    let logger2 = new Logger();
    /* tslint:enable:no-unused-variable */

    logger.info("2nd Logger - Writing default level to default console");
});

test("Logger can be instantiated with custom file parameter", async t => {
    let logger = new Logger();
    logger.addLoggerTransport(winston.transports.File, { filename: testLogFileName });
    logger.info("Writing default level to default console + file.");
    logger.warn("writing warn level to default console + file.");
    t.is(logger.getConfiguredLoggerTransports().length, 2);
});

test.after("Deleting created log file", async t => {
    let fullPathName = path.join(__dirname, testLogFileName);
    return fs.unlinkSync(fullPathName);
});
开发者ID:arjun-msft,项目名称:opent2t,代码行数:30,代码来源:OpenT2TTests.ts


示例3: request

    const loginResult = await request(app)
        .post("/test/api/user/login")
        .send({password: userForRegistration.password, username: userForRegistration.username});
    t.is(loginResult.status, 200);
    t.truthy(loginResult.body.isSuccess);
});

test("login:Error", async(t) => {
    const res = await request(app)
        .post("/test/api/user/login")
        .send({password: "adsdsdsdsdsdsdsdsdsdsdsdsdsds", username: "adsssssssssssss"});

    t.is(res.status, 404);
    t.falsy(res.body.isSuccess);
});

test("isLogged:Error", async(t) => {
    const res = await request(app)
        .post("/test/api/user/isLogged")
        .set("authorization", "nope");

    t.is(res.status, 401);
    t.falsy(res.body.isSuccess);
});


test.after("close connection to database", () => {
    mongoose.connection.close();
});
开发者ID:dominikus1993,项目名称:twitterClone,代码行数:29,代码来源:controllerTest.ts


示例4: test

});

test('hostname+path in options are not breaking redirects', async (t) => {
    t.is((await got(`${http.url}/relative`, {hostname: http.host, path: '/relative'})).body, 'reached');
});

test('redirect only GET and HEAD requests', async (t) => {
    try {
        await got(`${http.url}/relative`, {body: 'wow'});
        t.fail('Exception was not thrown');
    } catch (err) {
        t.is(err.message, 'Response code 302 (Found)');
        t.is(err.path, '/relative');
        t.is(err.statusCode, 302);
    }
});

test('redirects from httpt o https works', async (t) => {
    t.truthy((await got(`${http.url}/httpToHttps`, {rejectUnauthorized: false})).body);
});

test('redirects works with lowercase method', async (t) => {
    const body = (await got(`${http.url}/relative`, {method: 'head'})).body;
    t.is(body, '');
});

test.after('cleanup', async () => {
    await http.close();
    await https.close();
});
开发者ID:cyounkins,项目名称:typed-got,代码行数:30,代码来源:redirects.ts


示例5: tempfile

import {createServer} from './helpers/server';

const socketPath = tempfile('.socket');

let s;

test.before('setup', async () => {
    s = await createServer();

    s.on('/', (req, res) => {
        res.end('ok');
    });

    await s.listen(socketPath);
});

test('works', async (t) => {
    const url = format('http://unix:%s:%s', socketPath, '/');
    t.is((await got(url)).body, 'ok');
});

// "protocol-less works failed with "Protocol "unix:" not supported. Expected "http:".""
//t est('protocol-less works', async (t) => {
//  const url = format('unix:%s:%s', socketPath, '/');
//  t.is((await got(url)).body, 'ok');
// });

test.after('cleanup', async () => {
    await s.close();
});
开发者ID:cyounkins,项目名称:typed-got,代码行数:30,代码来源:unix-socket.ts


示例6: PNG

	const png = new PNG(buffer);
	const {pixels} = await pify(png.parse.bind(png))();
	return pixels;
};

let server;
let serverFileName;
test.before(async () => {
	server = await createServer();
	serverFileName = server.url
		.replace('http://', '')
		.replace(':', '!');
});

test.after(() => {
	server.close();
});

test('expose a constructor', t => {
	t.is(typeof Pageres, 'function');
});

test('add a source', t => {
	const pageres = new Pageres().src(server.url, ['1280x1024', '1920x1080']);
	t.is((pageres as any)._source[0].url, server.url);
});

test('set destination directory', t => {
	t.is((new Pageres().dest('tmp') as any)._destination, 'tmp');
});
开发者ID:sindresorhus,项目名称:pageres,代码行数:30,代码来源:test.ts



注:本文中的ava.after函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ava.afterEach函数代码示例发布时间:2022-05-25
下一篇:
TypeScript ava.ElementAt函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap