Assertions เป็นคำสั่งใน test ที่ ตรวจสอบว่าเงื่อนไขเป็นจริงหรือไม่ — ตรวจสอบว่าผลลัพธ์จริงตรงกับผลลัพธ์ที่คาดหวัง มันเป็นแกนกลางของวิธีที่ test ตัดสินว่าผ่านหรือไม่ผ่าน: หาก assertion ล้มเหลว test ก็จะล้มเหลว
assertion ทำอะไร
An ASSERTION checks that something is as expected:
→ "assert that the actual value EQUALS the expected value"
→ if TRUE → the assertion passes; if FALSE → the assertion FAILS → the TEST FAILS
→ Assertions are how a test VERIFIES behavior (the "check" part of a test).
ประเภทของ assertion ที่พบบ่อย
(result).();
(obj).({ : });
(value).();
(value).();
(value).();
(count).();
(price).();
(array).();
(array).();
(text).();
( ()).();
(value)..();
