本文整理匯總了TypeScript中expect.js類的典型用法代碼示例。如果您正苦於以下問題:TypeScript js類的具體用法?TypeScript js怎麽用?TypeScript js使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了js類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('fill correct data - no errors', function () {
//when
this.Data.Contacts.push(getItemDataTemplate());
this.Data.Contacts.push(getItemDataTemplate());
this.Data.Contacts.push(getItemDataTemplate());
//excercise
var result = this.MainValidator.Validate(this.Data);
//verify
expect(result.HasErrors).to.equal(false);
});
示例2: async
const createExpectSpaceAwareResults = (spaceId = DEFAULT_SPACE_ID) => async (resp: {
[key: string]: any;
}) => {
expect(resp.body)
.to.have.property('id')
.match(/^[0-9a-f-]{36}$/);
// loose ISO8601 UTC time with milliseconds validation
expect(resp.body)
.to.have.property('updated_at')
.match(/^[\d-]{10}T[\d:\.]{12}Z$/);
expect(resp.body).to.eql({
id: resp.body.id,
type: spaceAwareType,
updated_at: resp.body.updated_at,
version: 1,
attributes: {
title: 'My favorite vis',
},
});
const expectedSpacePrefix = spaceId === DEFAULT_SPACE_ID ? '' : `${spaceId}:`;
// query ES directory to ensure namespace was or wasn't specified
const { _source } = await es.get({
id: `${expectedSpacePrefix}${spaceAwareType}:${resp.body.id}`,
type: 'doc',
index: '.kibana',
});
const { namespace: actualNamespace } = _source;
if (spaceId === DEFAULT_SPACE_ID) {
expect(actualNamespace).to.eql(undefined);
} else {
expect(actualNamespace).to.eql(spaceId);
}
};
示例3: it
it('fill incorrect data - some errors', function () {
//when
this.Data.Checked = true;
this.Data.FirstName = "John Junior";
this.Data.LastName = "Smith";
//excercise
var result = this.PersonValidator.Validate(this.Data);
//verify
expect(result.HasErrors).to.equal(true);
});
示例4: done
jobs.jobs({ name: 'jobA', data: 'someData' }, (err, j) => {
if (err) {
return done(err);
}
expect(j).to.have.length(0);
jobs.jobs({ name: 'jobA' }, (err, j) => {
if (err) {
return done(err);
}
expect(j).to.have.length(1);
done();
});
});
示例5: expect
const createExpectNotSpaceAwareResults = (spaceId = DEFAULT_SPACE_ID) => (resp: {
[key: string]: any;
}) => {
expect(resp.body).to.eql({
id: `${notSpaceAwareId}`,
type: 'globaltype',
updated_at: '2017-09-21T18:59:16.270Z',
version: resp.body.version,
attributes: {
name: 'My favorite global object',
},
});
};
示例6: it
it('fill two items', function () {
//when
data.Hobbies = [
{HobbyName: "Skiing"},
{HobbyName: 'Chess'}
]
//exec
var result = businessRules.Validate(data);
//verify
expect(result.Errors["Hobbies"].HasErrors).to.equal(false)
});
示例7: it
it('should set members by parameters', () => {
expect(chrobject).to.be.ok();
expect(chrobject.entity).to.be.ok();
expect(chrobject.entity).to.eql(entity);
expect(chrobject.config).to.eql(config);
expect(chrobject.appService).to.be.ok();
expect(chrobject.appService).to.eql(new EntryAppService(entity, storage, options));
});
示例8: it
it("add first party caveat 3 times", function () {
// given
var m = new MacaroonsBuilder(location, secret, identifier)
.add_first_party_caveat("account = 3735928559")
.add_first_party_caveat("time < 2015-01-01T00:00")
.add_first_party_caveat("email = alice@example.org")
.getMacaroon();
expect(m.location).to.be(location);
expect(m.identifier).to.be(identifier);
expect(m.caveatPackets[0].type).to.be(CaveatPacketType.cid);
expect(m.caveatPackets[0].getValueAsText()).to.be("account = 3735928559");
expect(m.caveatPackets[1].type).to.be(CaveatPacketType.cid);
expect(m.caveatPackets[1].getValueAsText()).to.be("time < 2015-01-01T00:00");
expect(m.caveatPackets[2].type).to.be(CaveatPacketType.cid);
expect(m.caveatPackets[2].getValueAsText()).to.be("email = alice@example.org");
expect(m.signature).to.be("882e6d59496ed5245edb7ab5b8839ecd63e5d504e54839804f164070d8eed952");
});
示例9: it
it('should set entity and storage members', () => {
eas = new EntryAppService(entity, storage, options);
expect(eas instanceof EntryAppService).to.be.ok();
expect(eas.entity).to.be.ok();
expect(eas.entity).to.eql(entity);
expect(eas.storage).to.be.ok();
expect(eas.storage).to.eql(storage);
expect(eas.options).to.be.ok();
expect(eas.options).to.eql({
ignoreProperties: ['data.ignored'], ignoreSubProperties: []
});
});