<commit_before>'use strict';

/*
 *  These Specs provide a basic test of the buffering works as expected.
 */

var HttpBackend = require('../lib/http-backend-proxy');

describe('Context', function(){

	var browser;
    var proxy;

	beforeEach(function () {

		browser = { executeScript: function(){} };
		spyOn(browser, 'executeScript');

		proxy = new HttpBackend(browser);

	});

	it('should initialize to an empty object', function(){

		expect(proxy.context).toEqual({});

	});

	it('should forwarded to the browser even if empty', function(){

		proxy.whenGET('/someURL').respond(200);

		expect(browser.executeScript).toHaveBeenCalledWith(
			'$httpBackend.context={};window.$httpBackend.whenGET("/someURL").respond(200);');

	});

	it('should forwarded all basic data types', function(){

		proxy.context.string  = 'A string';
		proxy.context.number  = 1;
		proxy.context.boolean = true;

		proxy.whenGET('/someURL').respond(200);

		expect(browser.executeScript).toHaveBeenCalledWith(
			'$httpBackend.context={"string":"A string","number":1,"boolean":true};window.$httpBackend.whenGET("/someURL").respond(200);');

	});
});<commit_msg>More basic data proxy tests.<commit_after>'use strict';

/*
 *  These Specs provide a basic test of the buffering works as expected.
 */

var HttpBackend = require('../lib/http-backend-proxy');

describe('Context', function(){

	var browser;
    var proxy;

	beforeEach(function () {

		browser = { executeScript: function(){} };
		spyOn(browser, 'executeScript');

		proxy = new HttpBackend(browser);

	});

	it('should initialize to an empty object', function(){

		expect(proxy.context).toEqual({});

	});

	it('should forwarded to the browser even if empty', function(){

		proxy.whenGET('/someURL').respond(200);

		expect(browser.executeScript).toHaveBeenCalledWith(
			'$httpBackend.context={};window.$httpBackend.whenGET("/someURL").respond(200);');

	});

	it('should forwarded all basic data types', function(){

		proxy.context.string  = 'A string';
		proxy.context.number  = 1;
		proxy.context.boolean = true;

		proxy.whenGET('/someURL').respond(200);

		expect(browser.executeScript).toHaveBeenCalledWith(
			'$httpBackend.context={"string":"A string","number":1,"boolean":true};window.$httpBackend.whenGET("/someURL").respond(200);');

	});

	it('should forwarded arrays', function(){

		proxy.context.array = [1,2,3];

		proxy.whenGET('/someURL').respond(200);

		expect(browser.executeScript).toHaveBeenCalledWith(
			'$httpBackend.context={"array":[1,2,3]};window.$httpBackend.whenGET("/someURL").respond(200);');

	});

	it('should forwarded objects', function(){

		proxy.context.obj = {an: 'object'};

		proxy.whenGET('/someURL').respond(200);

		expect(browser.executeScript).toHaveBeenCalledWith(
			'$httpBackend.context={"obj":{"an":"object"}};window.$httpBackend.whenGET("/someURL").respond(200);');

	});

});
{'fraction_non_alphanumeric': 0.18506944444444445, 'fraction_numerical': 0.01597222222222222, 'mean_word_length': 5.182403433476395, 'pattern_counts': {'":': 9, '<': 3, '<?xml version=': 0, '>': 3, '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': '7031630', 'n_tokens_mistral': 971, 'n_tokens_neox': 874, 'n_words': 163}