<commit_before><commit_msg>Add unit test for the endpoints list component.<commit_after>
require('reflect-metadata');

var elc = require('../../../target/js/endpoints-list.component'),
    when = require('saywhen');

describe('Endpoints list component', function() {
    var activeService;
    var activeRoute;
    var modelService;
    var component;

    beforeEach(function() {
        modelService = jasmine.createSpyObj('modelService', ['getService']);
        activeService = {
            name: 'service0'
        };
        when(modelService.getService).isCalled.thenReturn(Promise.resolve(activeService));
        activeRoute = {
            params: [activeService]
        };

        component = new elc.EndpointsListComponent(modelService, activeRoute);
    });

    it('can be created', function() {
        expect(component).toBeDefined();
    });

    it('can be initialised', function(done) {
        component.ngOnInit();
        expect(modelService.getService).toHaveBeenCalledWith('service0');
        // Timeout needed to allow promise to invoke resolve handler
        setTimeout(function() {
            expect(component.service).toBe(activeService);
            done();
        }, 0);
    });
});

{'fraction_non_alphanumeric': 0.1319672131147541, 'fraction_numerical': 0.002459016393442623, 'mean_word_length': 2.839622641509434, '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': '3406196', 'n_tokens_mistral': 323, 'n_tokens_neox': 317, 'n_words': 65}