/*
    test.me -- GoAhead Unit Tests
 */

Me.load({

    targets: {

        /*
            Target for unit tests. Includes JST and form callbacks
         */
        'goahead-test': {
            enable: `me.settings.profile != 'release'`,
            type: 'exe',
            sources: [ 'test.c' ],
            depends: [ 'libgo', 'install-certs' ],
            scripts: {
                prebuild: `
                    if (me.settings.hasPam) {
                        me.target.libraries.push('pam')
                    }                                                                                      
                    cp(['${BIN}/self.key', '${BIN}/self.crt'], '.')
                `,  
            },
        },

        cgitest: {
            enable: 'me.settings.goahead.cgi',
            path: 'cgi-bin/cgitest${EXE}'
            type: 'exe',
            sources: [ 'cgitest.c' ],
            generate: false,
        },

        test: {
            action: `run('testme --depth ' + me.settings.depth)`,
            platforms: [ 'local' ],
            depends: [ 'test-prep' ],
            generate: false,
        },

       'test-prep': {
            platforms: [ 'local' ],
            depends: [ 'clean-test', 'build', 'cgitest' ],
            generate: false,
        },

        'clean-test': {
            type: 'clean',
            action: `
                Cmd.run('testme --clean')
                rm('cgi-bin/cgitest*')
            `
        }

    }
})
