Constconst obj = { prop: 'value' };
Object.freeze(obj);
expect(obj, 'to be frozen'); // ✓ passes
// All of these operations will fail silently (or throw in strict mode):
obj.prop = 'new value'; // Cannot modify existing property
obj.newProp = 'fail'; // Cannot add new property
delete obj.prop; // Cannot delete property
const regular = {};
expect(regular, 'to be frozen'); // ✗ fails - not frozen
Asserts that an object is frozen using
Object.isFrozen().A frozen object is completely immutable - no properties can be added, removed, or modified, and no property descriptors can be changed. This is the most restrictive object state. Frozen objects are automatically sealed and non-extensible.