Skip to content

verify ensureConfigOverride behaves as expected #127

@tminard

Description

@tminard

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions