It's getting to that point. All the major evergreen browsers have (mostly) functional class keyword. But what does this mean for unit tests and the ability to stub constructors? In short, the answer is 'no'.
Many will tell you that es6 classes are just sugar coated es5 functions with prototypal inheritance setup. Mostly true - but there are two considerations that make testing more difficult:
-
super is a magical keyword that calls the same method on the parent class. in cases with methods, easy enough to stub those,
sinon.stub(parent.prototype, 'whatever')
-- for super itself, there is no way to stub out the constructor call... normally not a huge deal, but... -
classes are not added to the global scope. where once you could call
sinon.stub(global, 'SomeFunction')
,sinon.stub(global, 'SomeClass')
(or under window in the browser), this will throw an error.
#!/bin/sh | |
# A simple script for remotely rebooting a Ubiquiti UniFi access point | |
# Version 1.0 (Dec 15, 2015) | |
# by Steve Jenkins (http://www.stevejenkins.com/) | |
# Requires sshpass (https://sourceforge.net/projects/sshpass/) which | |
# is probably available via dnf, yum, or apt on your *nix distro. | |
# USAGE |
#!/bin/bash | |
# Gather current power status | |
AC_POWER=`ioreg -l | grep ExternalConnected | cut -d"=" -f2 | sed -e 's/ //g'` | |
# Gather details about current wifi network | |
WIFI_NETWORK=`networksetup -getairportnetwork en0 | grep 'Current Wi-Fi Network' | cut -c 24-` | |
# Specify the name of your home / office wifi network here | |
HOME_WIFI=my_home_wifi |
#!/bin/bash | |
echo "Starting backup of appdata" | |
rclone sync /mnt/user/Docker\ Backup backblaze:some-bucket/Docker\ Backup --transfers 1 --bwlimit 75M | |
echo "Starting backup of Shared Documentation" | |
rclone sync /mnt/user/Shared\ Documentation backblaze:some-bucket/Shared\ Documentation --bwlimit 75M | |
echo "Starting backup of Read Media" | |
rclone sync /mnt/user/Read_Media/Music backblaze:some-bucket/Read_Media/Music --bwlimit 75M | |
echo "Starting backup of Pictures" | |
rclone sync /mnt/user/Pictures backblaze:some-bucket/Pictures --bwlimit 75M | |
echo "Starting backup of Workdata" |