本文整理匯總了TypeScript中monk.id函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript id函數的具體用法?TypeScript id怎麽用?TypeScript id使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了id函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: describe
describe('The deleted player page ', function () {
const tribe = {
_id: monk.id(),
id: 'delete_me',
name: 'Change Me'
};
const player1 = {_id: monk.id(), tribe: tribe.id, name: "player1", isDeleted: true};
const players = [player1];
beforeAll(async function () {
await tribeCollection.drop();
await tribeCollection.insert(tribe);
await e2eHelp.authorizeUserForTribes([tribe.id]);
await browser.get(`${hostName}/test-login?username=${e2eHelp.userEmail}&password="pw"`);
await playersCollection.drop();
await playersCollection.insert(players);
});
afterAll(async function () {
await tribeCollection.remove({id: tribe.id}, false);
await playersCollection.drop();
});
e2eHelp.afterEachAssertLogsAreEmpty();
it('will show the player data', async function () {
await browser.setLocation(`/${tribe.id}/retired-player/${player1._id}`);
expect(await deletedPlayerPage.playerNameTextField.getAttribute('value'))
.toBe(player1.name)
})
});
示例2: describe
describe("GET", function () {
let expectedPins = [
{_id: monk.id(), name: '1', tribe: tribeId},
{_id: monk.id(), name: '2', tribe: tribeId},
{_id: monk.id(), name: '3', tribe: tribeId}
];
beforeEach(function (done) {
pinCollection.remove({tribe: tribeId})
.then(function () {
return pinCollection.insert(expectedPins)
})
.then(done, done.fail);
});
afterEach(function (done) {
pinCollection.remove({tribe: tribeId})
.then(done, done.fail);
});
it('will return all available pins on tribe.', function (done) {
agent.get(path)
.expect(200)
.expect('Content-Type', /json/)
.then(function (response) {
expect(clean(response.body)).toEqual(clean(expectedPins));
})
.then(done, done.fail);
});
it('will return error when tribe is not available.', async function () {
await agent.get(badTribePath)
.expect(404)
});
});
示例3: beforeAll
beforeAll(async function () {
const pairAssignmentSet1 = new PairAssignmentDocument(new Date().toISOString(), [[
{
name: 'Ollie',
_id: monk.id()
},
{
name: 'Speedy',
_id: monk.id()
}
]]);
const pairAssignmentSet2 = new PairAssignmentDocument(new Date().toISOString(), [[
{name: 'Arthur', _id: monk.id()},
{name: 'Garth', _id: monk.id()}
]]);
const apiGuy = await ApiGuy.new();
await apiGuy.postTribe(tribe);
await Promise.all([
e2eHelp.authorizeUserForTribes([tribe.id]),
apiGuy.postPairAssignmentSet(tribe.id, pairAssignmentSet1),
apiGuy.postPairAssignmentSet(tribe.id, pairAssignmentSet2)
]);
await browser.waitForAngular();
await browser.setLocation(`/${tribe.id}/history`);
await browser.wait(() => element(By.id('history-view')).isPresent(), 2000)
});
示例4: describe
describe('The retired players page', function () {
const tribe = {
id: 'graveyard',
name: 'Arkham Asylum'
};
const player1 = {_id: monk.id(), tribe: tribe.id, name: "player1", isDeleted: true};
const player2 = {_id: monk.id(), tribe: tribe.id, name: "player2", isDeleted: true};
const player3 = {_id: monk.id(), tribe: tribe.id, name: "player3", isDeleted: null};
const player4 = {_id: monk.id(), tribe: tribe.id, name: "player4", isDeleted: true};
const players = [
player1,
player2,
player3,
player4
];
const retiredPlayers = [
player1,
player2,
player4
];
beforeAll(async function () {
await tribeCollection.insert(tribe);
await e2eHelp.authorizeUserForTribes([tribe.id]);
await playersCollection.drop();
await playersCollection.insert(players);
await browser.get(`${hostName}/test-login?username=${e2eHelp.userEmail}&password="pw"`);
await browser.waitForAngular();
});
afterAll(async function () {
await tribeCollection.remove({id: tribe.id}, false)
});
e2eHelp.afterEachAssertLogsAreEmpty();
beforeEach(async function () {
await browser.setLocation(`/${tribe.id}/players/retired`);
});
it('shows the retired players', async function () {
const playerElements = element.all(By.repeater('player in retiredPlayers'));
expect(playerElements.getText()).toEqual(pluck('name', retiredPlayers));
});
it('has a tribe card', function () {
const tribeCardHeaderElement = element(By.className("tribe-card-header"));
expect(tribeCardHeaderElement.getText()).toEqual(tribe.name);
});
});
示例5: describe
describe('DELETE', function () {
let newTribe = {
name: 'TeamMadeByTest',
id: 'deleteme',
email: 'test@test.test',
badgesEnabled: true,
_id: monk.id()
};
it('will remove a tribe from regular communications.', async function () {
await host.post(path)
.send(newTribe)
.expect(200)
.expect('Content-Type', /json/);
await host.delete(path + "/deleteme")
.expect(200);
const getAllResponse = await host.get(path)
.expect(200)
.expect('Content-Type', /json/);
const result = find(function (element) {
return element.name === 'TeamMadeByTest'
}, getAllResponse.body);
expect(result).toBeUndefined();
await host.get(path + '/deleteme')
.expect(404)
.expect('Content-Type', /json/);
});
})
示例6: it
it('GET will not return the tribe if a player had that email but had it removed.', async function () {
let tribe = {id: 'delete-me', name: 'tribe-from-endpoint-tests'};
let playerId = monk.id();
await Bluebird.all([
host.post(path).send(tribe),
host.post(path + '/players').send({
_id: playerId,
name: 'delete-me',
tribe: 'delete-me',
email: userEmail + '._temp'
})
]);
await authorizeUserForTribes([]);
await host.post(path + '/players').send({
_id: playerId,
name: 'delete-me',
tribe: 'delete-me',
email: 'something else '
});
const response = await host.get(path)
.expect(200)
.expect('Content-Type', /json/);
expect(clean(response.body)).toEqual(clean([]));
await Bluebird.all([
tribesCollection.remove({id: 'delete-me'}, false),
playersCollection.remove({_id: playerId})
]);
});
示例7: it
it('will return an error when the player does not exist.', function (done) {
let badId = monk.id();
let httpDelete = couplingServer.delete(path + "/" + badId);
httpDelete
.expect(404)
.expect({message: 'Player could not be deleted because they do not exist.'})
.then(done, done.fail);
});
示例8: setTimeout
setTimeout(function () {
let badId = monk.id();
agent.delete(path + '/' + badId)
.expect(404)
.then(function (response) {
expect(response.body).toEqual({message: 'Pair Assignments could not be deleted because they do not exist.'});
})
.then(done, done.fail);
});
示例9: it
it('will fail when pin does not exist', function (done) {
let httpDelete = agent.delete(path + "/" + monk.id());
httpDelete
.expect('Content-Type', /json/)
.expect(404)
.then(function (response) {
expect(response.body).toEqual({message: 'Failed to remove the pin because it did not exist.'});
})
.then(done, done.fail);
});