<commit_before>describe('button', function(){
    var MockMidiAdapter = function(){}
    MockMidiAdapter.prototype.send = function(){
        this.arguments = Array.prototype.slice.call(arguments);
    };

    var ANY_CHANNEL = 144;
    var ANY_NOTE = 0;
    var mockMidiAdapter;

    beforeEach(function(){
        mockMidiAdapter = new MockMidiAdapter();
    });


    it('should be observable', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        expect(button instanceof launchpad.Observable).toBe(true);
    });

    it('when turned red should sent channel, note, 3 to midiAdapter', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        button.turn('red');

        expect(mockMidiAdapter.arguments).toEqual([ANY_CHANNEL, ANY_NOTE, 3]);
    });

    it('when turned green should sent channel, note, 48 to midiAdapter', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        button.turn('green');

        expect(mockMidiAdapter.arguments).toEqual([ANY_CHANNEL, ANY_NOTE, 48]);
    });

    it('when turned orange should sent channel, note, 51 to midiAdapter', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        button.turn('orange');

        expect(mockMidiAdapter.arguments).toEqual([ANY_CHANNEL, ANY_NOTE, 51]);
    });
});<commit_msg>Turn button off<commit_after>describe('button', function(){
    var MockMidiAdapter = function(){}
    MockMidiAdapter.prototype.send = function(){
        this.arguments = Array.prototype.slice.call(arguments);
    };

    var ANY_CHANNEL = 144;
    var ANY_NOTE = 0;
    var mockMidiAdapter;

    beforeEach(function(){
        mockMidiAdapter = new MockMidiAdapter();
    });


    it('should be observable', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        expect(button instanceof launchpad.Observable).toBe(true);
    });

    it('when turned red should sent channel, note, 3 to midiAdapter', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        button.turn('red');

        expect(mockMidiAdapter.arguments).toEqual([ANY_CHANNEL, ANY_NOTE, 3]);
    });

    it('when turned green should sent channel, note, 48 to midiAdapter', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        button.turn('green');

        expect(mockMidiAdapter.arguments).toEqual([ANY_CHANNEL, ANY_NOTE, 48]);
    });

    it('when turned orange should sent channel, note, 51 to midiAdapter', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        button.turn('orange');

        expect(mockMidiAdapter.arguments).toEqual([ANY_CHANNEL, ANY_NOTE, 51]);
    });

    it('when turned off should sent channel, note, 0 to midiAdapter', function(){
        var button = new launchpad.Button(ANY_CHANNEL, ANY_NOTE, mockMidiAdapter);

        button.turn('off');

        expect(mockMidiAdapter.arguments).toEqual([ANY_CHANNEL, ANY_NOTE, 0]);
    });
});
{'fraction_non_alphanumeric': 0.12582573136206354, 'fraction_numerical': 0.009436929852154765, 'mean_word_length': 3.562410329985653, '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': '722538', 'n_tokens_mistral': 963, 'n_tokens_neox': 884, 'n_words': 217}