<commit_before>const Eknc = imports.gi.EosKnowledgeContent;

const InstanceOfMatcher = imports.tests.InstanceOfMatcher;

describe('Dictionary Object Model', function() {
    let dictionaryObject, jsonld;

    beforeEach(function() {
        jasmine.addMatchers(InstanceOfMatcher.customMatchers);

        jsonld = {
            '@id': 'ekn:word/Entreaty',
            'word': 'entreaty',
            'definition': 'An earnest request or petition; a plea.',
            'partOfSpeech': 'noun',
            'title': 'June 23rd',
        };
        dictionaryObject = Eknc.DictionaryObjectModel.new_from_json(jsonld);
    });

    describe('type', function() {
        it('should be a ContentObjectModel', function() {
            expect(dictionaryObject).toBeA(Eknc.ContentObjectModel);
        });

        it('should be a DictionaryObjectModel', function() {
            expect(dictionaryObject).toBeA(Eknc.DictionaryObjectModel);
        });
    });

    describe('JSON-LD marshaler', function() {
        it('should construct from a JSON-LD document', function() {
            expect(dictionaryObject).toBeDefined();
        });

        it('should marshal properties', function() {
            expect(dictionaryObject.word).toBe('entreaty');
            expect(dictionaryObject.definition).toBe('An earnest request or petition; a plea.');
            expect(dictionaryObject.part-of-speech).toBe('noun');
        });

        it('should inherit properties set by parent class (ContentObjectModel)', function() {
            expect(dictionaryObject.title).toBe('June 23rd');
        });
    });
});
<commit_msg>Test DictionaryObjectModel: correct usage of property<commit_after>const Eknc = imports.gi.EosKnowledgeContent;

const InstanceOfMatcher = imports.tests.InstanceOfMatcher;

describe('Dictionary Object Model', function() {
    let dictionaryObject, jsonld;

    beforeEach(function() {
        jasmine.addMatchers(InstanceOfMatcher.customMatchers);

        jsonld = {
            '@id': 'ekn:word/Entreaty',
            'word': 'entreaty',
            'definition': 'An earnest request or petition; a plea.',
            'partOfSpeech': 'noun',
            'title': 'June 23rd',
        };
        dictionaryObject = Eknc.DictionaryObjectModel.new_from_json(jsonld);
    });

    describe('type', function() {
        it('should be a ContentObjectModel', function() {
            expect(dictionaryObject).toBeA(Eknc.ContentObjectModel);
        });

        it('should be a DictionaryObjectModel', function() {
            expect(dictionaryObject).toBeA(Eknc.DictionaryObjectModel);
        });
    });

    describe('JSON-LD marshaler', function() {
        it('should construct from a JSON-LD document', function() {
            expect(dictionaryObject).toBeDefined();
        });

        it('should marshal properties', function() {
            expect(dictionaryObject.word).toBe('entreaty');
            expect(dictionaryObject.definition).toBe('An earnest request or petition; a plea.');
            expect(dictionaryObject.part_of_speech).toBe('noun');
        });

        it('should inherit properties set by parent class (ContentObjectModel)', function() {
            expect(dictionaryObject.title).toBe('June 23rd');
        });
    });
});

{'fraction_non_alphanumeric': 0.13074096754439682, 'fraction_numerical': 0.002449479485609308, 'mean_word_length': 2.7900232018561484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6610891', 'n_tokens_mistral': 897, 'n_tokens_neox': 848, 'n_words': 173}