Welcome to the Linux Foundation Forum!

Lab 16.2 - Test a Callback-Based API

Options
jsalcedo
jsalcedo Posts: 5
edited November 2022 in LFW211 Class Forum

Hi,

I have not been able to make the validate.js assertions test pass, it looks like the example shown in the "NODE.JS APPLICATION DEVELOPMENT (LFW211)" course for the "Writing Unit Test" using the tap library with callbacks is now deprecated. Specifically the "ifError()" and "strictDeepEqual()" assertions. I was able to make my tap test pass, but I can not make the validate.js test pass.

I think that the course needs to be updated as well as the validations in the lab exercises.

Comments

  • jsalcedo
    Options

    Hi @davidmarkclements, I thought about tagging you to see if you could take a look at my comment above. Thanks.

  • xdxmxc
    xdxmxc Posts: 148
    edited December 2022
    Options

    hey @jsalcedo - your issue here is to do with misunderstanding error() - it checks if the object is falsey (e.g. NOT an error).

    If the object is an error, then the assertion fails.

    What you'd need to do is assert against the expected error object instead (e.g. deepEquals or check properties with equals).

    As for deprecation messages, it's important to understand that these are forewarnings not indications of failure. While the course is still very much functional and relevant it is due a major update to Node 18, coming soon.

Categories

Upcoming Training