Testing Object Difference Detection Utility in GatsbyJS
This test suite validates the getDiff utility function in Gatsby Recipes, which compares two objects and generates a line-by-line difference with color coding. The tests ensure proper difference detection between object structures and verify the output formatting with ANSI color codes.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
gatsbyjs/gatsby
deprecated-packages/gatsby-recipes/src/providers/utils/get-diff.test.js
import getDiff from "./get-diff"
const oldValue = { a: `hi` }
const newValue = { b: `hi` }
it(`diffs values by line with color codes`, async () => {
const result = await getDiff(oldValue, newValue)
expect(result).toBeTruthy()
})