# All files / core/use-cases serve-files.spec.ts

100% Statements 18/18
100% Branches 0/0
100% Functions 4/4
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    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
    34
    35
    36
    37
    38
    391x

    1x

    1x
    1x

    1x

    1x

    1x
    1x

    1x

    1x
    1x

    1x

    1x

    1x
    1x
    1x

    1x
    1x

     import SetupFlags from '../../core/use-cases/setup-flags';

    import { CLIProgram } from '../../core/entities/cli-program';

    import ConfigurationRepository from '../../core/repositories/config.repository';

    import ServeFiles from './serve-files';
    import Logger from '../../infrastructure/logging/logger';

    const sinon = require('sinon');

    describe('Use-cases - Serve files', () => {
        let loggerStubInfo;

        before(() => {
            const currentProgram: CLIProgram = SetupFlags.setup({
                version: '0.0.1'
            });

            ConfigurationRepository.init(currentProgram);

            ConfigurationRepository.internalConfiguration.output = 'src';
            ConfigurationRepository.internalConfiguration.port = 8181;

            loggerStubInfo = sinon.stub(Logger, 'info');

            ServeFiles.serve(ConfigurationRepository.internalConfiguration);
        });

        after(() => {
            loggerStubInfo.restore();
            ServeFiles.stop();
        });

        it('should log informations about serve', () => {
            sinon.assert.calledWith(Logger.info, sinon.match('Serving documentation from'));
        });
    });