theme development – wp_script_add_data doesn’t seem to work

I have tried following the codex following various threads here, simple, copy-paste various examples but to no avail. It just doesn’t work.

Has it been depreciated? Has anyone got this to work in any recent version of WP or 5.7 specifically

 function my_scripts() {
wp_enqueue_script( 'bs-popper', '', array('jquery'), _S_VERSION, true );
wp_script_add_data('bs-popper' , array('integrity') , array('sha384-XXXXXXXXXXXXXXXX')); 
add_action( 'wp_enqueue_scripts', 'my_scripts' ); 

(EDIT) Simple:
Above example was from a version that had more than one but this simple one doesn’t work either

wp_script_add_data('bs-popper' , 'integrity' , 'sha384-XXXXXXX');