Beat Mix 2nd part,

I started the project “Beat Mix” with JavaScript and wrote this code :

// Use this presets array inside your presetHandler
const presets = require('./presets');

// Complete this function:
const presetHandler = (requestType,arrayIndex,newPresetArray) => {
    if (requestType === 'GET' ){
        if (arrayIndex){
            let GETarray = [404]
            return GETarray
        } else if (!arrayIndex) {
            const GETarray = [200,presets]
            return GETarray
        }
    } else if (requestType === 'PUT'){
        if (arrayIndex){
            let PUTarray = [404]
            return PUTarray
        } else if (!arrayIndex) {
            let PUTarray = [200,newPresetArray]
            return PUTarray
        }
    } else {
        let otherArray = [400]
        return otherArray
    }
};

// Leave this line so that your presetHandler function can be used elsewhere:
module.exports = presetHandler;

and I don’t know what I did wrong because in the test i receive such texts :

 Preset function - presetHandler.js file
    presetHandler() function
      √ should exist and be a function
      method === 'GET'
        √ should return an array
        √ should return 200 as the first element for a valid array index
        1) should return the correct preset array as the second element
        √ should return 404 as the first element for an out-of-range array index
      method === 'PUT'
        √ should return an array
        √ should return 200 as the first element for a valid array index
        √ should return the updated preset array as the second element
        2) should set the preset at the correct index with the new presetArray
        √ should return 404 as the first element for an out-of-range array index
      invalid method argument
        √ should return 400 as the first element if called without a 'GET' or 'PUT' method

I’d be very happy if u could help me with saying what’s wrong with the points 1) and 2) because I dont want to just copy the solution.