"use strict";
var __webpack_exports__ = {};
const isNewRecord_js_namespaceObject = require("../../collection-record/isNewRecord.js");
describe('recordUtilities', ()=>{
    let record;
    beforeEach(()=>{
        record = {};
    });
    describe('isNewRecord', ()=>{
        it('should return false for a record that has not been marked as new', ()=>{
            expect((0, isNewRecord_js_namespaceObject.isNewRecord)(record)).toBe(false);
        });
        it('should return true for a record that has been marked as new', ()=>{
            (0, isNewRecord_js_namespaceObject.markRecordAsNew)(record);
            expect((0, isNewRecord_js_namespaceObject.isNewRecord)(record)).toBe(true);
        });
        it('should return false for non-object types', ()=>{
            expect((0, isNewRecord_js_namespaceObject.isNewRecord)(null)).toBe(false);
            expect((0, isNewRecord_js_namespaceObject.isNewRecord)(void 0)).toBe(false);
            expect((0, isNewRecord_js_namespaceObject.isNewRecord)(42)).toBe(false);
            expect((0, isNewRecord_js_namespaceObject.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, isNewRecord_js_namespaceObject.isNewRecord)(record)).toBe(false);
        });
    });
    describe('markRecordAsNew', ()=>{
        it('should mark an object as new', ()=>{
            const markedRecord = (0, isNewRecord_js_namespaceObject.markRecordAsNew)(record);
            expect(markedRecord).toBe(record);
            expect((0, isNewRecord_js_namespaceObject.isNewRecord)(record)).toBe(true);
        });
        it('should not affect other properties of the object', ()=>{
            record.someProperty = 'some value';
            (0, isNewRecord_js_namespaceObject.markRecordAsNew)(record);
            expect(record.someProperty).toBe('some value');
        });
        it('should throw an error when trying to mark non-object types as new', ()=>{
            expect(()=>(0, isNewRecord_js_namespaceObject.markRecordAsNew)(null)).toThrow();
            expect(()=>(0, isNewRecord_js_namespaceObject.markRecordAsNew)(void 0)).toThrow();
            expect(()=>(0, isNewRecord_js_namespaceObject.markRecordAsNew)(42)).toThrow();
            expect(()=>(0, isNewRecord_js_namespaceObject.markRecordAsNew)('not an object')).toThrow();
        });
    });
});
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
