summaryrefslogtreecommitdiffstats
path: root/lib/models/__tests__/glossary.js
blob: 03456275a07aaaef3e97e07e6e358ca3e430bc66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
jest.autoMockOff();

describe('Glossary', function() {
    var File = require('../file');
    var Glossary = require('../glossary');
    var GlossaryEntry = require('../glossaryEntry');

    describe('createFromEntries', function() {
        var glossary = Glossary.createFromEntries(File(), [
            {
                name: 'Hello World',
                description: 'Awesome!'
            },
            {
                name: 'JavaScript',
                description: 'This is a cool language'
            }
        ]);

        it('must add all entries', function() {
            var entries = glossary.getEntries();
            expect(entries.size).toBe(2);
        });

        it('must add entries as GlossaryEntries', function() {
            var entries = glossary.getEntries();
            var entry = entries.get('hello-world');
            expect(entry instanceof GlossaryEntry).toBeTruthy();
        });
    });
});