<commit_before>define(['modules/connector'], function(Connector) {
    
    var publicRun = function() {
        asyncTest("Connector: Valid GET", function() {
            var onSuccess = function(response) {
                notEqual(response, null, "Test response not null");
                var expectedData = {
                    id:"<KEY>", 
                    label:"New_DFD!", 
                    type:"DataFlowDiagram", 
                    originator:"The Eugene", 
                    genericType:"Diagram", 
                    subDFDNode:"", 
                    nodes:[
                        {
                            id:"cabumEiAZdExZKbHDaumNT9KEoN0lwUJZwgyISIDre4x_id", 
                            type:"ExternalInteractor", 
                            label:"Some Interactor", 
                            x:"100", 
                            y:"100"
                        }, 
                        {
                            id:"mmWyh0gmygRejKr2meuRGSfLAl9oceUAhrG7foCquFox_id",
                            type:"DataStore", 
                            label:"Some Store", 
                            x:"200", 
                            y:"100"
                        }, 
                        {
                            id:"TgRGVyTIh0srk2zw7OndjUx9AcyNx4AymEWiOMnDMPwx_id",
                            type:"Process", 
                            label:"Some Proc", 
                            x:"100", 
                            y:"200"
                        }
                    ], 
                    links:[
                        {
                            id:"hClaOolenANwol8HZhcIK7ulTfDiEwFtRM2CMo9Ppxgx_id", 
                            type:"DataFlow", 
                            label:"Some Dataflow", 
                            origin_id:"TgRGVyTIh0srk2zw7OndjUx9AcyNx4AymEWiOMnDMPwx_id", 
                            dest_id:"nDnIae2poYlZu6x87lYuoSg7XYZ8jmxpx6xthnrp3qcx_id", 
                            x:"100", 
                            y:"200"
                        }
                    ], 
                    subDFDNodes:[
                        {
                            id:"nDnIae2poYlZu6x87lYuoSg7XYZ8jmxpx6xthnrp3qcx_id",
                            type:"Multiprocess",
                            label:"Some Multiprocess", 
                            x:"200", 
                            y:"200"
                        }
                    ]
                };
                
                ok(JSON.stringify(expectedData) === JSON.stringify(response.getData()), "Test if data was as expected");
                equal(response.getStatus(), "", "Response Status should be as expected.");
                equal(response.getError(), "", "Should be no error message");
                start();
            };
            
            var onFail = function(response) {
                ok(false, "Request should not fail");
                start();
            };
            
            Connector.get("Controller.php/0SrNZZv12jdsHcdS10ztKGnXDLq9236REL2qCjnjHnUx_id", onSuccess, onFail);
        });
        
        asyncTest("Connector: Invalid GET", function() {
            var onSuccess = function(response) {
                ok(false, "Request should not be successful");
                start();
            };
            
            var onFail = function(response) {
                ok(true, "Request should fail");
                notEqual(response, null, "Response should not be null");
                
                equal(response.getStatus(), "error", "Test status text on failure");
                equal(response.getError(), "GET Controller.php/some_id_thats_not_an_id 500 (Internal Server Error)", "Test error message on failure");
                start();
            };
            
            Connector.get("Controller.php/some_id_thats_not_an_id", onSuccess, onFail);
        });
        
        asyncTest("Connector: Valid PUT", function() {
            var onSuccess = function(response) {
                ok(true, "Request should be successful");
                start();
            };
            
            var onFail = function(response) {
                console.log(response.getError());
                ok(false, "Request should not fail");
                start();
            };
            
            var data = {
                id:"<KEY>", 
                label:"New_DFD!", 
                type:"DataFlowDiagram", 
                originator:"<NAME>", 
                genericType:"Diagram", 
                subDFDNode:"", 
                nodes:[
                    {
                        id:"cabumEiAZdExZKbHDaumNT9KEoN0lwUJZwgyISIDre4x_id", 
                        type:"ExternalInteractor", 
                        label:"Some Interactor", 
                        x:"100", 
                        y:"100"
                    }, 
                    {
                        id:"mmWyh0gmygRejKr2meuRGSfLAl9oceUAhrG7foCquFox_id",
                        type:"DataStore", 
                        label:"Some Store", 
                        x:"200", 
                        y:"100"
                    }, 
                    {
                        id:"TgR<KEY>",
                        type:"Process", 
                        label:"Some Proc", 
                        x:"100", 
                        y:"200"
                    }
                ], 
                links:[
                    {
                        id:"hClaOolenANwol8HZhcIK7ulTfDiEwFtRM2CMo9Ppxgx_id", 
                        type:"DataFlow", 
                        label:"Some Dataflow", 
                        origin_id:"TgRGVyTIh0srk2zw7OndjUx9AcyNx4AymEWiOMnDMPwx_id", 
                        dest_id:"nDnIae2poYlZu6x87lYuoSg7XYZ8jmxpx6xthnrp3qcx_id", 
                        x:"100", 
                        y:"200"
                    }
                ], 
                subDFDNodes:[
                    {
                        id:"nDnIae2poYlZu6x87lYuoSg7XYZ8jmxpx6xthnrp3qcx_id",
                        type:"Multiprocess",
                        label:"Some Multiprocess", 
                        x:"200", 
                        y:"200"
                    }
                ]
             };
             
            Connector.put("Controller.php/0SrNZZv12jdsHcdS10ztKGnXDLq9236REL2qCjnjHnUx_id", JSON.stringify(data), onSuccess, onFail);
        });
        
        asyncTest("Connector: Valid DELETE", function() {
            var onSuccess = function(response) {
                ok(true, "Request should be successful");
                start();
            };
            
            var onFail = function(response) {
                console.log(response.getError());
                ok(false, "Request should not fail");
                start();
            };
             
            Connector.delete("Controller.php/0SrNZZv12jdsHcdS10ztKGnXDLq9236REL2qCjnjHnUx_id", onSuccess, onFail);
        });
    };
    
    return {
        run: publicRun
    };
});<commit_msg>Summary - Moved expected data and urls so it can be shared by Connector tests<commit_after>define(['modules/connector'], function(Connector) {
    var expectedData = {
    id:"<KEY>", 
    label:"New_DFD!", 
    type:"DataFlowDiagram", 
    originator:"The Eugene", 
    genericType:"Diagram", 
    subDFDNode:"", 
    nodes:[
        {
            id:"<KEY>", 
            type:"ExternalInteractor", 
            label:"Some Interactor", 
            x:"100", 
            y:"100"
        }, 
        {
            id:"mmWyh0gmygRejKr2meuRGSfLAl9oceUAhrG7foCquFox_id",
            type:"DataStore", 
            label:"Some Store", 
            x:"200", 
            y:"100"
        }, 
        {
            id:"<KEY>",
            type:"Process", 
            label:"Some Proc", 
            x:"100", 
            y:"200"
        }
    ], 
    links:[
        {
            id:"hClaOolenANwol8HZhcIK7ulTfDiEwFtRM2CMo9Ppxgx_id", 
            type:"DataFlow", 
            label:"Some Dataflow", 
            origin_id:"TgRGVyTIh0srk2zw7OndjUx9AcyNx4AymEWiOMnDMPwx_id", 
            dest_id:"nDnIae2poYlZu6x87lYuoSg7XYZ8jmxpx6xthnrp3qcx_id", 
            x:"100", 
            y:"200"
        }
    ], 
    subDFDNodes:[
        {
            id:"nDnIae2poYlZu6x87lYuoSg7XYZ8jmxpx6xthnrp3qcx_id",
            type:"Multiprocess",
            label:"Some Multiprocess", 
            x:"200", 
            y:"200"
        }
    ]
};
    var validUrl = "Controller.php/0SrNZZv12jdsHcdS10ztKGnXDLq9236REL2qCjnjHnUx_id";
    var invalidUrl = "Controller.php/some_id_that_doesnt_exist";

    
    var publicRun = function() {
        asyncTest("Connector: Valid GET", function() {
            var onSuccess = function(response) {
                notEqual(response, null, "Test response not null");
                
                ok(JSON.stringify(expectedData) === JSON.stringify(response.getData()), "Test if data was as expected");
                equal(response.getStatus(), "", "Response Status should be as expected.");
                equal(response.getError(), "", "Should be no error message");
                start();
            };
            
            var onFail = function(response) {
                ok(false, "Request should not fail");
                start();
            };
            
            Connector.get(validUrl, onSuccess, onFail);
        });
        
        asyncTest("Connector: Invalid GET", function() {
            var onSuccess = function(response) {
                ok(false, "Request should not be successful");
                start();
            };
            
            var onFail = function(response) {
                ok(true, "Request should fail");
                notEqual(response, null, "Response should not be null");
                
                equal(response.getStatus(), "error", "Test status text on failure");
                equal(response.getError(), "GET " + invalidUrl + " 404 (Not Found)", "Test error message on failure");
                start();
            };
            
            Connector.get(invalidUrl, onSuccess, onFail);
        });
        
        asyncTest("Connector: Valid PUT", function() {
            var onSuccess = function(response) {
                ok(true, "Request should be successful");
                start();
            };
            
            var onFail = function(response) {
                console.log(response.getError());
                ok(false, "Request should not fail");
                start();
            };
            
            var data = {
                id:"<KEY>", 
                label:"New_DFD!", 
                type:"DataFlowDiagram", 
                originator:"<NAME>", 
                genericType:"Diagram", 
                subDFDNode:"", 
                nodes:[
                    {
                        id:"<KEY>", 
                        type:"ExternalInteractor", 
                        label:"Some Interactor", 
                        x:"100", 
                        y:"100"
                    }, 
                    {
                        id:"mmWyh0gmygRejKr2meuRGSfLAl9oceUAhrG7foCquFox_id",
                        type:"DataStore", 
                        label:"Some Store", 
                        x:"200", 
                        y:"100"
                    }, 
                    {
                        id:"<KEY>",
                        type:"Process", 
                        label:"Some Proc", 
                        x:"100", 
                        y:"200"
                    }
                ], 
                links:[
                    {
                        id:"hClaOolenANwol8HZhcIK7ulTfDiEwFtRM2CMo9Ppxgx_id", 
                        type:"DataFlow", 
                        label:"Some Dataflow", 
                        origin_id:"TgRGVyTIh0srk2zw7OndjUx9AcyNx4AymEWiOMnDMPwx_id", 
                        dest_id:"nDnIae2poYlZu6x87lYuoSg7XYZ8jmxpx6xthnrp3qcx_id", 
                        x:"100", 
                        y:"200"
                    }
                ], 
                subDFDNodes:[
                    {
                        id:"<KEY>",
                        type:"Multiprocess",
                        label:"Some Multiprocess", 
                        x:"200", 
                        y:"200"
                    }
                ]
             };
             
            Connector.put(validUrl, JSON.stringify(data), onSuccess, onFail);
        });
        
        asyncTest("Connector: Valid DELETE", function() {
            var onSuccess = function(response) {
                ok(true, "Request should be successful");
                start();
            };
            
            var onFail = function(response) {
                console.log(response.getError());
                ok(false, "Request should not fail");
                start();
            };
             
            Connector.delete(validUrl, onSuccess, onFail);
        });
    };
    
    return {
        run: publicRun
    };
});
{'fraction_non_alphanumeric': 0.0989925202259197, 'fraction_numerical': 0.021752404213097237, 'mean_word_length': 1.0177086541422853, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2127882', 'n_tokens_mistral': 3818, 'n_tokens_neox': 3374, 'n_words': 510}