# testing

[JS](..) ⟩ [debug]() ⟩ testing&#x20;

{% hint style="info" %}

{% endhint %}

{% tabs %}
{% tab title="📗 參考" %}
* [ ] Eloquent JavaScript ⟩ [Bugs & Errors](https://eloquentjavascript.net/08_error.html) ⟩ [Testing](https://eloquentjavascript.net/08_error.html#h_CCCzKyBrc1)
* [ ] replit ⟩ [docs](https://docs.replit.com/) ⟩ [Unit Testing](https://docs.replit.com/teams-edu/unit-testing)&#x20;
{% endtab %}

{% tab title="💈範例" %}
```javascript
function test(label, body) {
  if (!body()) console.log(`Failed: ${label}`);
}

test("convert Latin text to uppercase", () => {
  return "hello".toUpperCase() == "HELLO";
});

test("convert Greek text to uppercase", () => {
  return "Χαίρετε".toUpperCase() == "ΧΑΊΡΕΤΕ";
});

test("don't convert case-less characters", () => {
  return "مرحبا".toUpperCase() == "مرحبا";
});
```
{% endtab %}
{% endtabs %}
