I am looking to test an external Data Transfer Object (DTO) that undergoes frequent changes.
For example:
Here is a sample JavaScript (JSON) file below:
// JavaScript
const type User = {
id: Number,
name: String
}
// JSON
user: {
id: Number,
name: String,
}
Recently, the external API response has been modified.
// Example 1) Updated Response (Add)
{
id: Number,
name: String,
age: Number
}
// Example 2) Updated Response (Remove)
{
id: Number
}
// and so forth.
I am seeking a way to detect failures and update the JavaScript file accordingly.
So, how can I effectively test this external DTO?
In simpler terms, I need to verify any property changes.