+
+ {t('user.verification.title')}
+
+
+ {t('user.verification.message')}
+ {isSending ? (
+ <>
+
+ {t('user.verification.sending')}
+ >
+ ) : (
+
+ {t('user.verification.resend')}
+
+ )}
+
+
+ )
+}
+
+export default EmailVerification
diff --git a/resources/assets/tests/components/EmailVerification.test.ts b/resources/assets/tests/components/EmailVerification.test.ts
deleted file mode 100644
index 58032fa8..00000000
--- a/resources/assets/tests/components/EmailVerification.test.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import Vue from 'vue'
-import { mount } from '@vue/test-utils'
-import { flushPromises } from '../utils'
-import { toast } from '@/scripts/notify'
-import EmailVerification from '@/components/EmailVerification.vue'
-
-jest.mock('@/scripts/notify')
-
-test('message box should not be render if verified', () => {
- window.blessing.extra = { unverified: false }
- const wrapper = mount(EmailVerification)
- expect(wrapper.isEmpty()).toBeTrue()
-})
-
-test('resend email', async () => {
- window.blessing.extra = { unverified: true }
- Vue.prototype.$http.post
- .mockResolvedValueOnce({ code: 1, message: '1' })
- .mockResolvedValueOnce({ code: 0, message: '0' })
- const wrapper = mount(EmailVerification)
- const button = wrapper.find('a')
-
- button.trigger('click')
- await flushPromises()
- expect(toast.error).toBeCalledWith('1')
-
- button.trigger('click')
- await flushPromises()
- expect(toast.success).toBeCalledWith('0')
-})
diff --git a/resources/assets/tests/views/widgets/EmailVerification.test.tsx b/resources/assets/tests/views/widgets/EmailVerification.test.tsx
new file mode 100644
index 00000000..8e0793fa
--- /dev/null
+++ b/resources/assets/tests/views/widgets/EmailVerification.test.tsx
@@ -0,0 +1,35 @@
+import React from 'react'
+import { render, fireEvent, wait } from '@testing-library/react'
+import { t } from '@/scripts/i18n'
+import * as fetch from '@/scripts/net'
+import EmailVerification from '@/views/widgets/EmailVerification'
+
+jest.mock('@/scripts/net')
+
+describe('send email', async () => {
+ it('succeeded', async () => {
+ fetch.post.mockResolvedValue({ code: 0, message: 'success' })
+
+ const { getByText, getByRole, queryByText } = render(