Skip to content

Commit

Permalink
Merge pull request clearlydefined#98 from qtomlinson/qt/fix_compare
Browse files Browse the repository at this point in the history
Ensure license.declared is always compared
  • Loading branch information
ljones140 authored Oct 21, 2024
2 parents 970aba0 + affc438 commit dee931e
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { devApiBaseUrl, prodApiBaseUrl, getComponents, definition } = require('..
const nock = require('nock')
const fs = require('fs')

describe('Validation definitions between dev and prod', function () {
describe('Validate definitions', function () {
this.timeout(definition.timeout)

//Rest a bit to avoid overloading the servers
Expand Down Expand Up @@ -88,19 +88,21 @@ function compareDefinition(recomputedDef, expectedDef) {

function compareLicensed(result, expectation) {
let actual = omit(result.licensed, ['facets'])
const expected = omit(expectation.licensed, ['facets'])
let expected = omit(expectation.licensed, ['facets'])
actual = { declared: undefined, ...actual }
expected = { declared: undefined, ...expected }
deepStrictEqualExpectedEntries(actual, expected)
}

function compareDescribed(result, expectation) {
let actual = omit(result.described, ['tools'])
const actual = omit(result.described, ['tools'])
const expected = omit(expectation.described, ['tools'])
deepStrictEqualExpectedEntries(actual, expected)
}

function deepStrictEqualExpectedEntries(actual, expected) {
actual = pick(actual, Object.keys(expected))
deepStrictEqual(actual, expected)
const pickedActual = pick(actual, Object.keys(expected))
deepStrictEqual(pickedActual, expected)
}

function compareFiles(result, expectation) {
Expand Down

0 comments on commit dee931e

Please sign in to comment.