<commit_before>'use strict';

describe('SimulationService', function () {
    describe('sortDroits', function() {
        var DROITS_DESCRIPTION = { acs: { id: 'acs' }, apl: { id: 'apl' }};
        var service;

        beforeEach(function() {
            module('ddsApp');
            module(function($provide) {
                $provide.constant('droitsDescription', DROITS_DESCRIPTION);
            });
            inject(function(SimulationService) {
                service = SimulationService;
            });
        });

        it('should sort eligible and non eligible droits', function() {
            var openfiscaResult = { acs: 10 };
            var droits = service.sortDroits(openfiscaResult);
            expect(droits.droitsEligibles).toEqual({ acs: { id: 'acs', montant: 10 } });
            expect(droits.droitsNonEligibles).toEqual({ apl: { id: 'apl' } });
            expect(droits.droitsInjectes).toEqual({});
        });

        it('should sort eligible and injected droits', function() {
            var openfiscaResult = { acs: 10, apl: null };
            var droits = service.sortDroits(openfiscaResult);
            expect(droits.droitsEligibles).toEqual({ acs: { id: 'acs', montant: 10 } });
            expect(droits.droitsNonEligibles).toEqual({});
            expect(droits.droitsInjectes).toEqual({ apl: { id: 'apl' } });
        });
    });<commit_msg>Divide test into single-it tests<commit_after>'use strict';

describe('SimulationService', function () {
    describe('sortDroits', function() {
        var DROITS_DESCRIPTION = {
            acs: { id: 'acs' },
            apl: { id: 'apl' },
            ass: { id: 'ass'}
        };
        var service, droits, openfiscaResult;

        beforeEach(function() {
            module('ddsApp');
            module(function($provide) {
                $provide.constant('droitsDescription', DROITS_DESCRIPTION);
            });
            inject(function(SimulationService) {
                service = SimulationService;
            });
            openfiscaResult = { acs: 10, apl: null };
            droits = service.sortDroits(openfiscaResult);
        });

        it('should extract eligibles droits from openfisca result', function() {
            expect(droits.droitsEligibles).toEqual({ acs: { id: 'acs', montant: 10 } });
        });

        it('should extract injected droits', function() {
            expect(droits.droitsInjectes).toEqual({ apl: { id: 'apl' } });
        });

        it('should extract non eligibles droits', function() {
            expect(droits.droitsNonEligibles).toEqual({ ass: { id: 'ass' } });
        });
    });
{'fraction_non_alphanumeric': 0.1436150056839712, 'fraction_numerical': 0.004547176960970065, 'mean_word_length': 2.1845597104945718, 'pattern_counts': {'":': 0, '<': 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': '4138961', 'n_tokens_mistral': 791, 'n_tokens_neox': 767, 'n_words': 150}