Tests re-enabled for the Read API

NodeBB Development
  • Tonight I come to you all hat-in-hand as I reveal a blunder I made over a year ago...

    See, on 16 July of 2021, I was refactoring the Flags API, and adding new routes to the Write API for flags administration. While updating the API spec, I was impatient and wanted the tests to finish quicker, so I commented out a couple hundred tests so they'd run faster:


    I just also happened to forget to re-enable them 😱

    What does this mean?

    The test/api.js file dynamically generates tests to ensure that:

    1. The Read and Write APIs are syntactically correct as per the OpenAPI spec
    2. The routes defined in our spec files match the actual routes that NodeBB serves
    3. Each route responds correctly and that their response body matches what is expected

    We needed these tests because the OpenAPI spec is manually curated, and without them the spec would be out-of-sync with how NodeBB actually behaves.

    So the spec is out-of-sync?

    And how! I spent the past few days bringing the spec back up to date, and the PR was just merged today into bootstrap5, so as of v3, the Read API documentation will be in sync again. The Write API documentation remained in sync as those tests were enabled all along.


    If over the latter half of 2021 and 2022, this API synchronization bit you, I apologize! The changes to the APIs were mostly minor — a couple of properties were added to different routes, although there were some properties removed or renamed.

  • julianJ julian referenced this topic on

Suggested Topics

  • 0 Votes
    4 Posts
  • 0 Votes
    7 Posts
  • 0 Votes
    3 Posts
  • 0 Votes
    2 Posts
  • 0 Votes
    6 Posts