Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: delete api token handler test #1499

Merged
merged 2 commits into from
Sep 10, 2023
Merged

Conversation

WanShufen
Copy link
Collaborator

No description provided.

import { DeleteApiTokenCommandHandler } from './delete-api-token.command.handler'
import { None, Some } from 'oxide.ts'

describe('APITokenStrategy', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
describe('APITokenStrategy', () => {
describe('test DeleteApiTokenCommandHandler', () => {

userId = new UserId('user123')
})
test('Delete api token success', async () => {
cls.get.calledWith('user.userId').mockReturnValue('user123')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cls 和 repo 所有的 mock 都应该放在 beforeEach 里面

})
test('Delete api token success', async () => {
cls.get.calledWith('user.userId').mockReturnValue('user123')
apiToken.userId = userId
Copy link
Collaborator

@nichenqin nichenqin Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

常量的声明不用放这里,也不要放beforeEach,你可以直接在最外层的作用域 const

@nichenqin nichenqin temporarily deployed to delete-api-token-test - undb PR #1499 September 10, 2023 06:19 — with Render Destroyed
@nichenqin nichenqin merged commit eb54bee into develop Sep 10, 2023
2 checks passed
@nichenqin nichenqin deleted the delete-api-token-test branch September 10, 2023 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants