<commit_before>import {actionBuilder} from '../entity-actions-builder';
describe('The actionBuilder', () => {
    describe('when called with wrong parameters', () => {
//        let component;
        before(
            () => {
  //              const shallowRenderer = TestUtils.createRenderer();
    //            shallowRenderer.render(<Input/>);
      //          component = shallowRenderer.getRenderOutput();
            }
        );
        it('should throw a type error when called without all parameters', () => {
            expect(()=>{ actionBuilder()}).to.throw(TypeError,"Cannot read property 'name' of undefined");
            //name, type, service
        });
        it('should throw an error when called without a string name parameter', () => {
            const NAME_MESSAGE = 'ACTION_BUILDER: the name parameter should be a string.';
            expect(()=>{ actionBuilder({name: undefined})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 1})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: {}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: ()=>{}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test'})}).to.not.throw(NAME_MESSAGE);
        });
        it('should throw an error when called without a string type parameter : load,save,delete', () => {
            const NAME_MESSAGE = 'ACTION_BUILDER: the type parameter should be a string and the value one of these: load,save,delete.';
            expect(()=>{ actionBuilder({name: 'test'})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: undefined})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 1})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: {}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: ()=>{}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: ''})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'nimp'})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load'})}).to.not.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'save'})}).to.not.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'delete'})}).to.not.throw(NAME_MESSAGE);
        });
    })
});
<commit_msg>[action builder] Add test validation on service<commit_after>import {actionBuilder} from '../entity-actions-builder';
describe('The actionBuilder', () => {
    describe('when called with wrong parameters', () => {
//        let component;
        before(
            () => {
  //              const shallowRenderer = TestUtils.createRenderer();
    //            shallowRenderer.render(<Input/>);
      //          component = shallowRenderer.getRenderOutput();
            }
        );
        it('should throw a type error when called without all parameters', () => {
            expect(()=>{ actionBuilder()}).to.throw(TypeError,"Cannot read property 'name' of undefined");
            //name, type, service
        });
        it('should throw an error when called without a string name parameter', () => {
            const NAME_MESSAGE = 'ACTION_BUILDER: the name parameter should be a string.';
            expect(()=>{ actionBuilder({name: undefined})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 1})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: {}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: ()=>{}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test'})}).to.not.throw(NAME_MESSAGE);
        });
        it('should throw an error when called without a string type parameter : load,save,delete', () => {
            const NAME_MESSAGE = 'ACTION_BUILDER: the type parameter should be a string and the value one of these: load,save,delete.';
            expect(()=>{ actionBuilder({name: 'test'})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: undefined})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 1})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: {}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: ()=>{}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: ''})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'nimp'})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load'})}).to.not.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'save'})}).to.not.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'delete'})}).to.not.throw(NAME_MESSAGE);
        });
        it('should throw an error when called without a Promise service parameter', () => {
            const NAME_MESSAGE = 'ACTION_BUILDER: the service parameter should be a Promise.';
            expect(()=>{ actionBuilder({name: 'test', type: 'load'})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load', service: undefined})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load', service: 1})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load', service: 'nimp'})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load', service: ()=>{}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load', service: {}})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load', service: null})}).to.throw(NAME_MESSAGE);
            expect(()=>{ actionBuilder({name: 'test', type: 'load', service: Promise.resolve({test: 'test'})})}).to.not.throw(NAME_MESSAGE);
        });
    })
});

{'fraction_non_alphanumeric': 0.20013091147111767, 'fraction_numerical': 0.0008181966944853543, 'mean_word_length': 3.1549966009517334, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 63, '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': '4258627', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1679, 'n_words': 388}