Modo entrevista. Cronômetro de 4 min, sem dicas e sem autocompletar
Request method
FácilTypeScript types4 min
Write a function successStatus(method) for API tests. It returns the status code of a successful response. For 'GET' it is 200, for 'POST' 201, for 'DELETE' 204.
The parameter method accepts only these three strings, any other string must be a type error. Do not change the code at the bottom, each line after @ts-expect-error must stay a type error.
Exemplos
successStatus('GET')Retorna 200
successStatus('POST')Retorna 201
successStatus('DELETE')Retorna 204
Função
Carregando o editor...
- Entrada
successStatus('GET')Esperado200 - Entrada
successStatus('POST')Esperado201
Os testes ocultos rodam no envio