Nodejs Learning (a): Assert module

Source: Internet
Author: User

The     Assert module provides simple assertion testing capabilities, primarily for internal use, and may be used externally after require (' assert '). The API for the     assert module is locked state, which means that the API for this module will no longer be added or modified.      assert Module Method list:        assert (value[, message])         assert.deepequal (Actual, expected[, message])          Assert.deepstrictequal (Actual, expected[, message])         assert.doesnotthrow (block [, Error] [, message])         assert.equal (Actual, expected[, message])         assert.fail (actual, expected, message, operator)         assert.iferror (value)         assert.notdeepequal (Actual, expected[, message])          assert.notdeepstrictequal (Actual, expected[, message])          Assert.notequal (Actual, expected[, message])      &nbsp  assert.notstrictequal (Actual, expected[, message])         assert.ok (value[, Message])         assert.strictequal (Actual, expected[, message])          assert.throws (block[, error][, message])
    • ASSERT (Value[,message])
ASSERT () is a shorthand for Assert.ok (), which is used in the same way. If value is true, nothing will happen. If value is False, an error is thrown that is a message.
    • Assert.ok (value[, message])
The reference.
    • Assert.equal (Actual, expected[, message])
Determines whether the actual value (actual) is equal to the expected 徝 (expected) (= =), and if not equal, throws a message error.
    • Assert.notequal (Actual, expected[, message])
The reference.
    • Assert.deepequal (Actual, expected[, message])
Deep means that the enumerable properties of the child objects are also computed. Passed if both the property and the child object properties are equal. Otherwise, an error is thrown.
    • Assert.notdeepequal (Actual, expected[, message])
The reference.
    • Assert.strictequal (Actual, expected[, message])
Usage, like assert.deepequal (), determines whether the condition is exactly equal (= = =).
    • Assert.notstrictequal (Actual, expected[, message])
The reference.
    • Assert.deepstrictequal (Actual, expected[, message])
Determine whether the condition is strictly equal to the depth.
    • Assert.notdeepstrictequal (Actual, expected[, message])
The reference. These groups have the same API usage, only the conditions are different
    • Assert.fail (actual, expected, message, operator)
Determines if the message is wrong (falsy), and if it is wrong (Falsy) throws an error message: The actual value operation operator expected. If the message is correct (truthy), then the message is thrown as a message error message.
    • Assert.iferror (value)
Determines whether value is false, if false, and if ture, throws an error that the information is value.
    • Assert.throws (block[, error][, message])
This is not very clear for the time being.
    • Assert.doesnotthrow (block[, error][, message])
This is not very clear for the time being.

Nodejs Learning (a): Assert module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.