diff --git a/test/functionName.test.js b/test/functionName.test.js
index 681acdcba..8fe63b9b4 100644
--- a/test/functionName.test.js
+++ b/test/functionName.test.js
@@ -1,20 +1,19 @@
const expect = require('expect');
+const { functionName } = require('./_30s.js');
let output = '';
-const functionName = fn => fn.name;
test('functionName is a Function', () => {
expect(functionName).toBeInstanceOf(Function);
});
test('Works for native functions', () => {
- expect(functionName(Math.max)).toBe('max');
+ expect(typeof functionName(Math.max)).toBe('function');
});
-function fun(x) {
+function f(x) {
return x;
}
-test('Works for functions', () => {
- expect(functionName(fun)).toBe('fun');
+test('Works for normal functions', () => {
+ expect(typeof functionName(f)).toBe('function');
});
-const fn = x => x;
test('Works for arrow functions', () => {
- expect(functionName(fn)).toBe('fn');
+ expect(typeof functionName(x => x)).toBe('function');
});
diff --git a/test/hz.test.js b/test/hz.test.js
index 34cc4c187..72ac91d40 100644
--- a/test/hz.test.js
+++ b/test/hz.test.js
@@ -4,3 +4,9 @@ const {hz} = require('./_30s.js');
test('hz is a Function', () => {
expect(hz).toBeInstanceOf(Function);
});
+test('hz returns a number', () => {
+ expect(typeof hz(x => x)).toBe('number');
+});
+test('hz returns a number', () => {
+ expect(typeof hz(x => x, 10)).toBe('number');
+});
diff --git a/test/insertAfter.test.js b/test/insertAfter.test.js
index 3363c30ea..df05bb871 100644
--- a/test/insertAfter.test.js
+++ b/test/insertAfter.test.js
@@ -4,3 +4,10 @@ const {insertAfter} = require('./_30s.js');
test('insertAfter is a Function', () => {
expect(insertAfter).toBeInstanceOf(Function);
});
+let e = document.createElement('div');
+e.setAttribute("id", "test");
+test('Does not throw error if the element exists', () => {
+ expect(() => {
+ insertAfter(e, 'test');
+ }).not.toThrow(TypeError);
+});
diff --git a/test/insertBefore.test.js b/test/insertBefore.test.js
index f78e3e17a..332fe9cb2 100644
--- a/test/insertBefore.test.js
+++ b/test/insertBefore.test.js
@@ -4,3 +4,10 @@ const {insertBefore} = require('./_30s.js');
test('insertBefore is a Function', () => {
expect(insertBefore).toBeInstanceOf(Function);
});
+let e = document.createElement('div');
+e.setAttribute("id", "test");
+test('Does not throw error if the element exists', () => {
+ expect(() => {
+ insertBefore(e, 'test');
+ }).not.toThrow(TypeError);
+});
diff --git a/test/isBrowserTabFocused.test.js b/test/isBrowserTabFocused.test.js
index 1d3bf771d..75bc8f47a 100644
--- a/test/isBrowserTabFocused.test.js
+++ b/test/isBrowserTabFocused.test.js
@@ -4,3 +4,6 @@ const {isBrowserTabFocused} = require('./_30s.js');
test('isBrowserTabFocused is a Function', () => {
expect(isBrowserTabFocused).toBeInstanceOf(Function);
});
+test('isBrowserTabFocused is a Function', () => {
+ expect(typeof isBrowserTabFocused()).toBe('boolean');
+});