<commit_before>describe('Generate User operation', function() {
    var generate_user, ajax;
    beforeEach(function() {
        setFixtures('<tr id="362"><td><a class="generate_user"></a></td><td class="response"><span></span></td></tr>');
        generate_user = $('.generate_user');

        generate_user.generate_user();
    });
    it('makes an ajax request when clicked',function(){
        spyOn($, "ajax");
        generate_user.click();
        var args = $.ajax.calls.mostRecent();
        expect(args.data).toEqual({ id: '362' });
        expect(args.dataType).toEqual('json');
        expect(args.type).toEqual('POST');
        expect(args.url).toEqual('/orphans')
    });
    it('inserts text and removes button if successful', function() {
        spyOn( $, "ajax" ).and.callFake(function (params) {

          params.success("hi");
        });
        generate_user.click();
        expect($('#362 span')).toHaveText('hi');
        expect($('#362 .response a').length).toBe(0)
    });
    it('inserts failure message if unsuccessful', function() {
        spyOn( $, "ajax" ).and.callFake(function (params) {

          params.error("error");<commit_msg>Extract Args from new object returned by mostRecent<commit_after>describe('Generate User operation', function() {
    var generate_user, ajax;
    beforeEach(function() {
        setFixtures('<tr id="362"><td><a class="generate_user"></a></td><td class="response"><span></span></td></tr>');
        generate_user = $('.generate_user');

        generate_user.generate_user();
    });
    it('makes an ajax request when clicked',function(){
        spyOn($, "ajax");
        generate_user.click();
        var args = $.ajax.calls.mostRecent().args[0];
        expect(args.data).toEqual({ id: '362' });
        expect(args.dataType).toEqual('json');
        expect(args.type).toEqual('POST');
        expect(args.url).toEqual('/orphans')
    });
    it('inserts text and removes button if successful', function() {
        spyOn( $, "ajax" ).and.callFake(function (params) {

          params.success("hi");
        });
        generate_user.click();
        expect($('#362 span')).toHaveText('hi');
        expect($('#362 .response a').length).toBe(0)
    });
    it('inserts failure message if unsuccessful', function() {
        spyOn( $, "ajax" ).and.callFake(function (params) {

          params.error("error");
{'fraction_non_alphanumeric': 0.19001677852348994, 'fraction_numerical': 0.011325503355704697, 'mean_word_length': 3.035532994923858, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3090645', 'n_tokens_mistral': 704, 'n_tokens_neox': 684, 'n_words': 132}