404 Error on trying to enqueue a JS file

Your syntax is wrong. The action must be defined outside of the callback.

Also, you are using plugin_dir_path() function, which gets the path to plugin directoy in the filesystem of the server, not the url. You should use plugin_dir_url() instead.

add_action( 'wp_enqueue_scripts', 'myplugin_load_script' );
function myplugin_load_script() {
    wp_enqueue_script( 'myplugin-testjs', plugin_dir_url( __FILE__ ) . "scripts/myplugin-test.js", array('jquery'), null, true );

}

tech