<commit_before>describe("Begin", function() {
    var testNodeId = 2;
    var testNode;
    var testBegin;

    beforeEach(function() {
	testNode = new window.sirius.Node({id: testNodeId});
	testBegin = new window.sirius.Begin({node: testNode});
    });

    it("should not blow up on to_xml", function() {
	var doc = document.implementation.createDocument("document:xml", "begin");
	var out = testBegin.to_xml(doc); 
	expect(out).not.toBeNull();
    });

    it("should contain test node", function() {
	expect(testBegin.get('node')).toEqual(testNode);
    });

    it("should resolve node_id as node", function() {
	var b = new window.sirius.Begin({node_id: testNodeId});
	var deferred = [];
	var object_with_id = { 'node': [] };
	object_with_id.node[testNodeId] = testNode;
	expect(b.get('node')).toBeUndefined();
	b.resolve_references(deferred, object_with_id);
	runDeferred(deferred);
	expect(b.get('node')).toEqual(testNode);
    });

    it("should encode node reference as node_id", function() {
	// should not contain node_id at first
	expect(testBegin.get('node_id')).toBeUndefined();
	testBegin.encode_references();
	expect(testBegin.get('node_id')).toEqual(testNodeId);
    })

});<commit_msg>Modify CreateDocument call to be Firefox compatible<commit_after>describe("Begin", function() {
    var testNodeId = 2;
    var testNode;
    var testBegin;

    beforeEach(function() {
	testNode = new window.sirius.Node({id: testNodeId});
	testBegin = new window.sirius.Begin({node: testNode});
    });

    it("should not blow up on to_xml", function() {
	var doc = document.implementation.createDocument("document:xml", "begin", null);
	var out = testBegin.to_xml(doc); 
	expect(out).not.toBeNull();
    });

    it("should contain test node", function() {
	expect(testBegin.get('node')).toEqual(testNode);
    });

    it("should resolve node_id as node", function() {
	var b = new window.sirius.Begin({node_id: testNodeId});
	var deferred = [];
	var object_with_id = { 'node': [] };
	object_with_id.node[testNodeId] = testNode;
	expect(b.get('node')).toBeUndefined();
	b.resolve_references(deferred, object_with_id);
	runDeferred(deferred);
	expect(b.get('node')).toEqual(testNode);
    });

    it("should encode node reference as node_id", function() {
	// should not contain node_id at first
	expect(testBegin.get('node_id')).toBeUndefined();
	testBegin.encode_references();
	expect(testBegin.get('node_id')).toEqual(testNodeId);
    })

});
{'fraction_non_alphanumeric': 0.16422167889160555, 'fraction_numerical': 0.0008149959250203749, 'mean_word_length': 4.845238095238095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5418028', 'n_tokens_mistral': 820, 'n_tokens_neox': 814, 'n_words': 163}