<commit_before>var R = require('../../../src/Router');
var Routes = require('./../../data');
var noOp = function() {};
var chai = require('chai');
var expect = chai.expect;
var falcor = require('falcor');
var $ref = falcor.Model.ref;
var sinon = require("sinon");

describe('Set', function() {
    it('should perform a simple set.', function(done) {
        var did = false;
        var called = 0;
        var router = new R([{
            route: 'videos[{integers:id}].rating',
            set: function(json) {
                try {
                    expect(json).to.deep.equals({
                        videos: {
                            1234: { rating: 5 },<commit_msg>added 3 disabled tests for set related problems<commit_after>var R = require('../../../src/Router');
var Routes = require('./../../data');
var noOp = function() {};
var chai = require('chai');
var expect = chai.expect;
var falcor = require('falcor');
var $ref = falcor.Model.ref;
var sinon = require("sinon");

describe('Set', function() {

    xit('should call get() with the same type of arguments when no route for set() found.', function(done) {
        var router = new R([
            {
                route: "titlesById[{integers:titleIds}].rating",
                get: function(json) {
                
                    var exception = false
                    try {
                        expect(json).to.deep.equals(
                            [
                               "titlesById",
                               [
                                  0
                               ],
                               "rating"
                            ]
                        )
                    } catch (e) {
                        exception = true
                        done(e);
                    }
                    if (!exception) {
                        done()
                    }
                }
        
            }
        ]);

        router.
            set({
                "jsonGraph": {
                    "titlesById": {
                        "0": {
                            "rating": 5
                        }
                    }
                },
                "paths": [["titlesById", 0, "rating"]]
            }).
            subscribe(noOp, noOp, noOp);
    });



    xit('should not transform set values before passing them to route. (0)', function(done) {
        var router = new R([{
            route: 'titlesById[{integers:titleIds}].userRating',
            set: function(json) {
                var exception = false
                try {
                    expect(json).to.deep.equals({
                        "titlesById": {
                            "1": {
                                "userRating": 0
                            }
                        }
                    })
                } catch (e) {
                    exception = true
                    done(e);
                }
                if (!exception) {
                    done()
                }

            }
        }]);

        router.
            set({
                "jsonGraph": {
                    "titlesById": {
                        "1": {
                            "userRating": 0
                        }
                    }
                },
                "paths": [
                    [
                        "titlesById",
                        1,
                        "userRating"
                    ]
                ]
            }).
            subscribe(noOp, noOp, noOp);
    });

    
    xit('should not transform set values before passing them to route.  ("")', function(done) {
        var router = new R([{
            route: 'titlesById[{integers:titleIds}].userRating',
            set: function(json) {
                var exception = false
                try {
                    expect(json).to.deep.equals({
                        "titlesById": {
                            "1": {
                                "userRating": ""
                            }
                        }
                    })
                } catch (e) {
                    exception = true
                    done(e);
                }
                if (!exception) {
                    done()
                }

            }
        }]);

        router.
            set({
                "jsonGraph": {
                    "titlesById": {
                        "1": {
                            "userRating": ""
                        }
                    }
                },
                "paths": [
                    [
                        "titlesById",
                        1,
                        "userRating"
                    ]
                ]
            }).
            subscribe(noOp, noOp, noOp);
    });


    it('should perform a simple set.', function(done) {
        var did = false;
        var called = 0;
        var router = new R([{
            route: 'videos[{integers:id}].rating',
            set: function(json) {
                try {
                    expect(json).to.deep.equals({
                        videos: {
                            1234: { rating: 5 },
{'fraction_non_alphanumeric': 0.11372774267662263, 'fraction_numerical': 0.004977982002680452, 'mean_word_length': 0.7384359400998336, 'pattern_counts': {'":': 21, '<': 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': '4981293', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1158, 'n_words': 264}