import * as __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__ from "../../collection-record/isNewRecord.mjs";
describe('recordUtilities', ()=>{
    let record;
    beforeEach(()=>{
        record = {};
    });
    describe('isNewRecord', ()=>{
        it('should return false for a record that has not been marked as new', ()=>{
            expect((0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.isNewRecord)(record)).toBe(false);
        });
        it('should return true for a record that has been marked as new', ()=>{
            (0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.markRecordAsNew)(record);
            expect((0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.isNewRecord)(record)).toBe(true);
        });
        it('should return false for non-object types', ()=>{
            expect((0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.isNewRecord)(null)).toBe(false);
            expect((0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.isNewRecord)(void 0)).toBe(false);
            expect((0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.isNewRecord)(42)).toBe(false);
            expect((0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.isNewRecord)('not an object')).toBe(false);
        });
        it('should not be fooled by properties that mimic the internal Symbol key', ()=>{
            const fakeKey = 'Symbol(isNewRecord)';
            record[fakeKey] = true;
            expect((0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.isNewRecord)(record)).toBe(false);
        });
    });
    describe('markRecordAsNew', ()=>{
        it('should mark an object as new', ()=>{
            const markedRecord = (0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.markRecordAsNew)(record);
            expect(markedRecord).toBe(record);
            expect((0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.isNewRecord)(record)).toBe(true);
        });
        it('should not affect other properties of the object', ()=>{
            record.someProperty = 'some value';
            (0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.markRecordAsNew)(record);
            expect(record.someProperty).toBe('some value');
        });
        it('should throw an error when trying to mark non-object types as new', ()=>{
            expect(()=>(0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.markRecordAsNew)(null)).toThrow();
            expect(()=>(0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.markRecordAsNew)(void 0)).toThrow();
            expect(()=>(0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.markRecordAsNew)(42)).toThrow();
            expect(()=>(0, __WEBPACK_EXTERNAL_MODULE__collection_record_isNewRecord_mjs__.markRecordAsNew)('not an object')).toThrow();
        });
    });
});
