<commit_before>'use strict';

var module = angular.module('module',['ngResource', 'ngNestedResource']);

describe("Nested Resource", function(){


    beforeEach(module('module'));

    var organizations, httpBackend;


    beforeEach(inject(function($httpBackend, nestedResource){

        httpBackend = $httpBackend;

        organizations = nestedResource("/api/organizations/", {
            getAll: {method: "GET", isArray: true},
            create: {method: "POST"},
            get: {
                route: "@/",
                method: "GET",
                nested: {
                    update: { method: "PUT" },
                    delete: { method: "DELETE" },
                    workers: {
                        method: "GET",
                        route: "workers/",
                        isArray: true,
                        nested: {
                            update: {
                                method: "PUT",
                                route: "@/"
                            }
                        }
                    }
                }
            }
        });
    }));

    it("should verify all calls are handled correctly", function(){

        organizations.getAll();
        httpBackend.expectGET("/api/organizations").respond([{id:1, name:"Google.com"}]);
        httpBackend.flush();

        organizations.create({name: "Google.com"});
        httpBackend.expectPOST("/api/organizations").respond({id:1, name:"Google.com"});
        httpBackend.flush();

        var organization = organizations.get(1);
        httpBackend.expectGET("/api/organizations/1").respond({id:1, name:"Google.com"});
        httpBackend.flush();

        organization.$update({name: "Bing.com"});
        httpBackend.expectPUT("/api/organizations/1").respond({id:1, name:"Bing.com"});
        httpBackend.flush();

        var workers = organization.$workers();
        httpBackend.expectGET("/api/organizations/1/workers?").respond([{id:264, name:"No Name"}]);
        httpBackend.flush();

        workers.$update(264, {name: "<NAME>"});
        httpBackend.expectPUT("/api/organizations/1/workers", {param:264, name: "<NAME>"})
            .respond({id:264, name:"<NAME>"});
        httpBackend.flush();

    })


})<commit_msg>Update NestedResrourceSpec.js<commit_after>'use strict';

var module = angular.module('module',['ngResource', 'ngNestedResource']);

describe("Nested Resource", function(){


    beforeEach(module('module'));

    var organizations, httpBackend;


    beforeEach(inject(function($httpBackend, nestedResource){

        httpBackend = $httpBackend;

        organizations = nestedResource("/api/organizations/", {
            getAll: {method: "GET", isArray: true},
            create: {method: "POST"},
            get: {
                route: "@/",
                method: "GET",
                nested: {
                    update: { method: "PUT" },
                    delete: { method: "DELETE" },
                    workers: {
                        method: "GET",
                        route: "workers/",
                        isArray: true,
                        nested: {
                            update: {
                                method: "PUT",
                                route: "@/"
                            }
                        }
                    }
                }
            }
        });
    }));

    it("should verify all calls are handled correctly", function(){

        organizations.getAll();
        httpBackend.expectGET("/api/organizations").respond([{id:1, name:"Google.com"}]);
        httpBackend.flush();

        organizations.create({name: "Google.com"});
        httpBackend.expectPOST("/api/organizations").respond({id:1, name:"Google.com"});
        httpBackend.flush();

        var organization = organizations.get(1);
        httpBackend.expectGET("/api/organizations/1").respond({id:1, name:"Google.com"});
        httpBackend.flush();

        organization.$update({name: "Bing.com"});
        httpBackend.expectPUT("/api/organizations/1", {name: "Bing.com"}).respond({id:1, name:"Bing.com"});
        httpBackend.flush();

        var workers = organization.$workers();
        httpBackend.expectGET("/api/organizations/1/workers?").respond([{id:264, name:"No Name"}]);
        httpBackend.flush();

        workers.$update(264, {name: "<NAME>"});
        httpBackend.expectPUT("/api/organizations/1/workers", {param:264, name: "<NAME>"})
            .respond({id:264, name:"<NAME>"});
        httpBackend.flush();

    })


})
{'fraction_non_alphanumeric': 0.157917760279965, 'fraction_numerical': 0.009186351706036745, 'mean_word_length': 1.7448979591836735, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6246118', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1169, 'n_words': 193}