Conversation
Contributor
Author
|
测试user加缓存的个接口的set和unset缓存情况: async function user() {
const userId = '678df3f10c92661e5658c688';
const employeeId = '6667c4c1c74fc105e50564b4';
const username = 'eva';
const phone = '1888888' + faker.string.numeric(4);
// 获取用户
await request(url)
.get(`/users/${userId}`)
.expect(200)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Get User');
});
// 更新用户
await request(url)
.patch(`/users/${userId}`)
.set('x-api-key', apiKey)
.send({
employeeId,
})
.expect(200)
.then((res) => {
console.log('Update User');
});
//Upsert user by employeeId
await request(url)
.post(`/users/${employeeId}/@upsertUserByEmployeeId`)
.send({
phone,
})
.expect(201)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Upsert user by employeeId');
});
// upsert user by username
await request(url)
.post(`/users/${username}/@upsertUserByUsername`)
.send({
phone,
})
.expect(201)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Upsert user by username');
});
// upsert user by phone
await request(url)
.post(`/users/${phone}/@upsertUserByPhone`)
.send({
phone: '1888888' + faker.string.numeric(4),
})
.expect(201)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Upsert user by phone');
});
// update password
await request(url)
.post(`/users/${userId}/@updatePassword`)
.send({
oldPassword: 'eva@36node.com',
newPassword: 'eva@36node.com2',
})
.expect(204)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Update password');
});
// delete user
await request(url)
.delete(`/users/${userId}`)
.expect(204)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Delete user');
});
} |
Contributor
Author
|
namespace 测试: async function namespaces() {
// get namespace by key
await request(url)
.get(`/namespaces/key1`)
.expect(200)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Get namespace by key');
});
// get namespace by id
await request(url)
.get(`/namespaces/6790577ba570fcb8cb15a83f`)
.expect(200)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Get namespace by id');
});
// update namespace by key
await request(url)
.patch(`/namespaces/key1`)
.send({
name: 'name2',
})
.expect(200)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Update namespace by key');
});
// update namespace by id
await request(url)
.patch(`/namespaces/6790577ba570fcb8cb15a83f`)
.send({
name: 'name2',
})
.expect(200)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Update namespace by id');
});
//delete namespace
await request(url)
.delete(`/namespaces/6790577ba570fcb8cb15a83f`)
.expect(204)
.set('x-api-key', apiKey)
.then((res) => {
console.log('Delete namespace');
});
}测试结果: |
zzswang
approved these changes
Jan 25, 2025
zzswang
pushed a commit
that referenced
this pull request
Feb 9, 2025
🤖 I have created a release *beep* *boop* --- ## [2.5.0](v2.4.0...v2.5.0) (2025-02-09) ### Features * [缓存] 给 auth 添加 redis 缓存 ([#53](#53)) ([94a01d2](94a01d2)) ### Bug Fixes * openapi ([742d087](742d087)) * user level ([0872969](0872969)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


相关资料