本文整理匯總了TypeScript中@pushrocks/tapbundle.tap類的典型用法代碼示例。如果您正苦於以下問題:TypeScript tap類的具體用法?TypeScript tap怎麽用?TypeScript tap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了tap類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: async
import * as smartstring from '../ts/index';
import { tap, expect } from '@pushrocks/tapbundle';
// git
let testGit: smartstring.GitRepo;
tap.test('expect create a new Git class GitRepo', async () => {
testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git');
expect(testGit).be.instanceof(smartstring.GitRepo);
});
tap.test('expect return a .host', async () => {
expect(testGit.host).equal('github.com');
});
tap.test('expect return a .user', async () => {
expect(testGit.user).equal('pushrocks');
});
tap.test('expect return a .repo', async () => {
expect(testGit.repo).equal('smartstring');
});
tap.test('expect return a .httpsUrl', async () => {
expect(testGit.httpsUrl).equal('https://github.com/pushrocks/smartstring.git');
});
tap.test('expect return a .sshUrl', async () => {
expect(testGit.sshUrl).equal('git@github.com:pushrocks/smartstring.git');
});
tap.start();
示例2: async
import { expect, tap } from '@pushrocks/tapbundle';
import * as serverconfig from '../ts/index';
tap.test('first test', async () => {
serverconfig;
});
tap.start();
示例3: async
import * as smartstring from '../ts/index';
import { tap, expect } from '@pushrocks/tapbundle';
// Domain
let testDomain: smartstring.Domain;
let testDomain2: smartstring.Domain;
tap.test('expect create a new Domain object', async () => {
testDomain = new smartstring.Domain('https://level3D.level2D.level1D');
expect(testDomain).be.instanceof(smartstring.Domain);
console.log(testDomain);
});
tap.test('expect have a .topLevel', async () => {
expect(testDomain.topLevel).equal('level1D');
});
tap.test('expect have a .level2', async () => {
expect(testDomain.level2).equal('level2D');
});
tap.test('expect have a .level3', async () => {
expect(testDomain.level3).equal('level3D');
});
tap.test('expect have the correct dns zone name', async () => {
expect(testDomain.zoneName).equal('level2D.level1D');
});
tap.test('expect have the correct protocol', async () => {
expect(testDomain.protocol).equal('https');
});
tap.test('testDomain2 expect be a basic domain', async () => {
testDomain2 = new smartstring.Domain('bleu.de');
console.log(testDomain2);
});
示例4: async
import * as smartstring from '../ts/index';
import { tap, expect } from '@pushrocks/tapbundle';
// Base64
let testBase64: smartstring.Base64;
tap.test('expect create a valid instance of Base64', async () => {
testBase64 = new smartstring.Base64('somestring', 'string');
expect(testBase64).be.instanceOf(smartstring.Base64);
});
tap.test('expect read output a file as base64 and base64uri', async () => {
expect(testBase64.base64String).not.equal(testBase64.base64UriString);
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri');
expect(testBase64_2.simpleString).equal(testBase64.simpleString);
});
tap.start();
示例5: require
import { tap, expect } from '@pushrocks/tapbundle';
import projectinfo = require('../ts/index');
let path = require('path');
let testBasePath = path.resolve(__dirname);
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' });
tap.test('should have .packageJson', async () => {
expect(myNpm.packageJson).have.property('version', '1.0.0');
expect(myNpm.packageJson).have.property('name', 'testpackage');
});
tap.test('should have .version', async () => {
expect(myNpm).have.property('version', '1.0.0');
});
tap.test('should have .name', async () => {
expect(myNpm).have.property('name', 'testpackage');
});
tap.test('should have .license', async () => {
expect(myNpm).have.property('license', 'MIT');
});
tap.test('should have .git', async () => {
expect(myNpm.git.httpsUrl).equal('https://sometoken@github.com/someuser/somerepo.git');
});
tap.test('should return a name', async () => {
expect(projectinfo.getNpmNameForDir(testBasePath)).equal('testpackage');
});
tap.start();
示例6: async
import * as smartstring from '../ts/index';
import { tap, expect } from '@pushrocks/tapbundle';
// indent
let testString = `
base
expect be indented
some more
base
indented
`;
// normalize
tap.test('expect normalize a string', async () => {
testString = smartstring.indent.normalize(testString);
console.log(testString);
let zoneNameArg = 'test1';
let destinationIpArg = '111';
});
// indent with prefix
tap.test('expect indent', async () => {
testString = smartstring.indent.indentWithPrefix(testString, '>> ');
console.log(testString);
});
tap.start();
示例7: require
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartdelay from '@pushrocks/smartdelay';
import early = require('../ts/index');
tap.test('.start()', async () => {
early.start('early');
await smartdelay.delayFor(2000);
});
tap.test('.stop()', async () => {
await early.stop();
});
tap.test('hrTime Measurement', async () => {
let earlyHr = new early.HrtMeasurement();
earlyHr.start();
await smartdelay.delayFor(1000);
let measuredTime = earlyHr.stop();
console.log(measuredTime);
return expect(measuredTime.milliSeconds).to.be.greaterThan(999);
});
tap.start();
示例8: require
import { expect, tap } from '@pushrocks/tapbundle';
import smartssh = require('../ts/index');
import path = require('path');
let testSshInstance: smartssh.SshInstance;
let testSshKey: smartssh.SshKey;
tap.test('should create a valid SshKey object', async () => {
testSshKey = new smartssh.SshKey({
host: 'example.com',
private: 'someExamplePrivateKey',
public: 'someExamplePublicKey'
});
expect(testSshKey).to.be.instanceof(smartssh.SshKey);
});
tap.test('.type should be a valid type', async () => {
expect(testSshKey.type).equal('duplex');
});
tap.test('.publicKey should be public key', async () => {
expect(testSshKey.pubKey).equal('someExamplePublicKey');
});
tap.test('.privateKey should be private key', async () => {
expect(testSshKey.privKey).equal('someExamplePrivateKey');
});
tap.test('.publicKeyBase64 should be public key base 64 encoded', async () => {
// tslint:disable-next-line:no-unused-expression
testSshKey.pubKeyBase64;
});
tap.test('.store() should store the file to disk', async () => {
testSshKey.store(path.join(process.cwd(), 'test/temp'));
});
示例9: async
import * as smartstring from '../ts/index';
import { tap, expect } from '@pushrocks/tapbundle';
// Docker
tap.test('expect create a Env Object', async () => {
let envStringArray = ['VIRTUAL_HOST=sub.domain.tld', 'DEFAULT_HOST=some.domain.com'];
let envObject: any = smartstring.docker.makeEnvObject(envStringArray);
expect(envObject.VIRTUAL_HOST).to.equal('sub.domain.tld');
expect(envObject.DEFAULT_HOST).to.equal('some.domain.com');
});
tap.start();
示例10: async
import { tap, expect } from '@pushrocks/tapbundle';
import * as smartstring from '../ts/index';
tap.test('should normalize a string', async () => {
const testString = `
myawesome string;
is indented with two spaces
`;
const normalizedString = smartstring.normalize.standard(testString);
expect(normalizedString).to.equal(
`
myawesome string;
is indented with two spaces
`
);
});
tap.start();