<commit_before>'use strict';
const Lab = require( 'lab' );
const lab = exports.lab = Lab.script();
const Server = require( '../resources/server' );
const Lcrud = require( '../index' ).Lcrud;
const runTests = require( '../index' ).runTests;

lab.experiment('Test the example server using the main function', ( ) => {

    const definition = {
        title: 'Title of the test with value of {pre.half1} + {input.itemId}',
        pre: [
            {
                assign: 'half1',
                name: 'half1 ( = 5)',
                method: function ( reply ) {

                    // no err
                    reply( null, 5 );
                }
            }
        ],
        paramSets: [
            {
                input: {
                    titleComplement: 'hello mommy',
                    itemId: 5
                },
                output: {
                    statusCode: 200
                }
            },
            {
                input: {
                    itemId: 10
                },
                output: {
                    statusCode: 404
                }
            }
        ],
        inject: function ( pre, input ) {

            const request = new Lcrud( '/items', null, null );
            return request.get( null, null, input.itemId + pre.half1 );
        }
    };

    runTests(definition, Server, lab);


});

lab.experiment('Test the example server using the main function on the other route', ( ) => {

    const definition = {
        title: 'Title of the test ',
        pre: [],
        paramSets: [
            {
                input: { },
                output: {
                    statusCode: 200,
                    payload: function (code, payload){

                        code.expect(payload.message).to.equal('hello');
                    }
                }
            }
        ],
        inject: function ( pre, input ) {

            const request = new Lcrud( '/items', null, null );
            return request.get( null, null );
        }
    };

    runTests(definition, Server, lab);
});
<commit_msg>fix in placement of titleCompplement in example<commit_after>'use strict';
const Lab = require( 'lab' );
const lab = exports.lab = Lab.script();
const Server = require( '../resources/server' );
const Lcrud = require( '../index' ).Lcrud;
const runTests = require( '../index' ).runTests;

lab.experiment('Test the example server using the main function', ( ) => {

    const definition = {
        title: 'Title of the test with value of {pre.half1} + {input.itemId}',
        pre: [
            {
                assign: 'half1',
                name: 'half1 ( = 5)',
                method: function ( reply ) {

                    // no err
                    reply( null, 5 );
                }
            }
        ],
        paramSets: [
            {
                titleComplement: 'hello mommy',
                input: {
                    itemId: 5
                },
                output: {
                    statusCode: 200
                }
            },
            {
                input: {
                    itemId: 10
                },
                output: {
                    statusCode: 404
                }
            }
        ],
        inject: function ( pre, input ) {

            const request = new Lcrud( '/items', null, null );
            return request.get( null, null, input.itemId + pre.half1 );
        }
    };

    runTests(definition, Server, lab);


});

lab.experiment('Test the example server using the main function on the other route', ( ) => {

    const definition = {
        title: 'Title of the test ',
        pre: [],
        paramSets: [
            {
                input: { },
                output: {
                    statusCode: 200,
                    payload: function (code, payload){

                        code.expect(payload.message).to.equal('hello');
                    }
                }
            }
        ],
        inject: function ( pre, input ) {

            const request = new Lcrud( '/items', null, null );
            return request.get( null, null );
        }
    };

    runTests(definition, Server, lab);
});

{'fraction_non_alphanumeric': 0.11745126010461246, 'fraction_numerical': 0.008559201141226819, 'mean_word_length': 1.1066599899849774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4461840', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1031, 'n_words': 290}