Skip to content

測試討論 #288

Oct 27, 2022 · 5 comments · 1 reply
Discussion options

You must be logged in to vote

根據你想測的東西,我來寫的話大概會是:

  1. 測試 datePicker UI 是否呈現當下時間,這個 render 出來看一下畫面上指定位置有沒有包含相對應的文字就知道了
  2. mock API,並確認畫面上呈現的是不是 api response 的資訊,這邊 mock response 寫死是沒問題的,這邊只是要測「前端是不是根據 api response 來 render」
  3. 測試前端是否用指定參數去 call API,這個有點像你本來想做的,不過「指定參數」這件事情其實就有點麻煩,我在想你可以試試看能不能 mock new Date() 之類的東西,讓當前時間變成你指定的內容,就會好做很多,如果沒辦法的話,就把範圍縮小,測說 call API 的指定參數的 day 是不是你預期中的 day 就好

第三點應該可以透過 mock fetch 或是你用的其他 library 來拿到參數

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@cwc329
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by s103071049
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants