<commit_before>var should = require("should");

var coap = require("coap");
var coapInNode = require("../coap/coap-in.js");
var functionNode = require("/var/www/node-red/nodes/core/core/80-function.js");
var helper = require("./helper.js");

describe('CoapInNode', function() {
    beforeEach(function(done) {
        helper.startServer(done);
    });

    afterEach(function(done) {
        helper.unload().then(function() {
            helper.stopServer(done);
        });
    });

    it('should be loaded', function(done) {
        var flow = [
                    {
                        id:"coapServer1",
                        type:"coap-server",
                        name:"coapServer",
                        port:5683
                    },
                    {
                        id:"coapIn1",
                        type:"coap in",
                        name:"coapIn",
                        url:"/test",
                        server:"coapServer1"
                    }
                   ];

        //need to register nodes in order to use them
        var testNodes = [coapInNode];
        helper.load(testNodes, flow, function() {
            var coapIn1 = helper.getNode("coapIn1");
            coapIn1.options.should.have.property('name', 'coapIn');
            coapIn1.options.should.have.property('url', '/test');
            coapIn1.options.should.have.property('server');
            done();
        });
    });

    it('should accept GET requests', function(done) {
        var flow = [
                    {
                        id:"coapServer1",
                        type:"coap-server",
                        name:"coapServer",
                        port:8888
                    },
                    {
                        id:"coapIn1",
                        type:"coap in",
                        name:"coapIn",
                        url:"/test",
                        server:"coapServer1",
                        wires:[["coapOut1"]]
                    },
                    {
                        id:'coapOut1',
                        type:"function",
                        name:"coapOut",
                        func:"msg.res.end('whatup');\nreturn msg;",
                        wires:[]
                    }
                   ];
        //need to register nodes in order to use them
        var testNodes = [functionNode, coapInNode];
        helper.load(testNodes, flow, function() {
            var req   = coap.request('coap://localhost:8888/test');

            req.on('response', function(res) {
                res.pipe(process.stdout);
                done();
            });

            req.end();
        });
    });
});
<commit_msg>Change the path of the function node<commit_after>var should = require("should");

var coap = require("coap");
var coapInNode = require("../coap/coap-in.js");
var functionNode = require("../node_modules/node-red/nodes/core/core/80-function.js");
var helper = require("./helper.js");

describe('CoapInNode', function() {
    beforeEach(function(done) {
        helper.startServer(done);
    });

    afterEach(function(done) {
        helper.unload().then(function() {
            helper.stopServer(done);
        });
    });

    it('should be loaded', function(done) {
        var flow = [
                    {
                        id:"coapServer1",
                        type:"coap-server",
                        name:"coapServer",
                        port:5683
                    },
                    {
                        id:"coapIn1",
                        type:"coap in",
                        name:"coapIn",
                        url:"/test",
                        server:"coapServer1"
                    }
                   ];

        //need to register nodes in order to use them
        var testNodes = [coapInNode];
        helper.load(testNodes, flow, function() {
            var coapIn1 = helper.getNode("coapIn1");
            coapIn1.options.should.have.property('name', 'coapIn');
            coapIn1.options.should.have.property('url', '/test');
            coapIn1.options.should.have.property('server');
            done();
        });
    });

    it('should accept GET requests', function(done) {
        var flow = [
                    {
                        id:"coapServer1",
                        type:"coap-server",
                        name:"coapServer",
                        port:8888
                    },
                    {
                        id:"coapIn1",
                        type:"coap in",
                        name:"coapIn",
                        url:"/test",
                        server:"coapServer1",
                        wires:[["coapOut1"]]
                    },
                    {
                        id:'coapOut1',
                        type:"function",
                        name:"coapOut",
                        func:"msg.res.end('whatup');\nreturn msg;",
                        wires:[]
                    }
                   ];
        //need to register nodes in order to use them
        var testNodes = [functionNode, coapInNode];
        helper.load(testNodes, flow, function() {
            var req   = coap.request('coap://localhost:8888/test');

            req.on('response', function(res) {
                res.pipe(process.stdout);
                done();
            });

            req.end();
        });
    });
});

{'fraction_non_alphanumeric': 0.12855579868708972, 'fraction_numerical': 0.009846827133479213, 'mean_word_length': 1.0666917859834213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '3584648', 'n_tokens_mistral': 1448, 'n_tokens_neox': 1343, 'n_words': 226}