bedrock icon indicating copy to clipboard operation
bedrock copied to clipboard

verify ensureConfigOverride behaves as expected

Open tminard opened this issue 1 year ago • 0 comments

This would be expected to pass:

    describe('when dealing with nested objects', function() {
      it('should not throw if registered field is changed', function() {
        const config = {
          nested: {
            foo: {
              pleaseChangeMe: 'pleaseChangeMe'
            }
          }
        };

        const snapshot = bedrock._snapshotOverrideFields({
          config,
          fields: [
            'nested'
          ]
        });

        // change fields
        config.nested.foo.pleaseChangeMe = 'changed';

        const fn = bedrock._ensureConfigOverride.bind(this, {
          config,
          configOverrideSnapshot: snapshot
        });

        expect(fn).to.not.throw();
      });
    });

However:

  1 failing

  1) bedrock
       _ensureConfigOverride
         when dealing with nested objects
           should not throw if registered field is changed:
     AssertionError: expected [Function bound _ensureConfigOverride] to not throw an error but 'Error: The config field "nested" must…' was thrown

Config values are set in the map directly, but if parent path values are added to fields to watch then they will not be detected as properly changed. Exact desired behavior here when registering root paths needs to be decided

tminard avatar Feb 05 '25 17:02 tminard