From ba24ed6d2a414455918b8015a6560ecfb72521b4 Mon Sep 17 00:00:00 2001 From: Stephen Date: Tue, 26 Sep 2023 02:23:09 +0200 Subject: [PATCH] Remove old test --- tests/example-test.js | 45 ------------------------------------ tests/tests.css | 28 ----------------------- tests/tests.js | 53 ------------------------------------------- 3 files changed, 126 deletions(-) delete mode 100755 tests/example-test.js delete mode 100755 tests/tests.css delete mode 100755 tests/tests.js diff --git a/tests/example-test.js b/tests/example-test.js deleted file mode 100755 index 256bf94..0000000 --- a/tests/example-test.js +++ /dev/null @@ -1,45 +0,0 @@ - -// Import test runner -import test from '../../fn/modules/test.js'; - -// test(name, expected, fn) -test("Example synchronous test", ['First expected result', 'Second expected result'], (expect, done) => { - // Test thing - expect('First expected result'); - expect('Second expected result'); - - // End of test - done(); -}); - -// test(name, expected, fn) -test("Example asynchronous test", [0, undefined], (expect, done) => { - // Wait for thing to happen - const promise = new Promise((resolve, reject) => setTimeout(resolve, 2000)); - - promise.then(() => { - // Test thing - expect(0); - expect(undefined); - - // End of test - done(); - }); -}); - - -// test(name, expected, fn) -/* -test("Example failing test", [true], (expect, done) => { - // Wait for thing to happen - const promise = new Promise((resolve, reject) => setTimeout(resolve, 2000)); - - promise.then(() => { - // Test thing (should fail) - expect(false); - - // End of test - done(); - }); -}); -*/ diff --git a/tests/tests.css b/tests/tests.css deleted file mode 100755 index 99793c8..0000000 --- a/tests/tests.css +++ /dev/null @@ -1,28 +0,0 @@ -body { - padding: 0 0 2.5rem 0; -} - -.console-pre { - padding: 0 1.25rem 0 1.25rem; - border-left: 2px solid #dddddd; -} - -.result-pre { - position: fixed; - bottom: 0; - left: 0; - right: 0; - margin: 0; - padding: 1.25rem; - box-shadow: 0 0 20px rgba(10, 0, 20, 0.125) -} - -.pass-result-pre { - color: black; - background-color: greenyellow; -} - -.fail-result-pre { - color: white; - background-color: orangered; -} diff --git a/tests/tests.js b/tests/tests.js deleted file mode 100755 index 40848d5..0000000 --- a/tests/tests.js +++ /dev/null @@ -1,53 +0,0 @@ - -// Console - -const consolePre = document.getElementById('console'); -const log = window.console.log; -const trace = window.console.trace; - -let n = 0; - -function stripCSS(output, string) { - // If this is a CSS string, ignore - if (n) { - --n; - return output; - } - - // Count CSS strings that will appear as next arguments - const text = string - .replace(/%c/g, () => (++n, '')) - .replace(/%s/, ''); - - output.push(text); - return output; -} -/* -window.console.log = function() { - log.apply(this, arguments); - const strings = Array.from(arguments).reduce(stripCSS, []); - consolePre.append(strings.join('') + '\n'); -}; - -window.console.trace = function() { - trace.apply(this, arguments); - const strings = Array.from(arguments).reduce(stripCSS, []); - consolePre.append(strings.join('') + '\n'); -}; -*/ - -// Result - -const resultPre = document.getElementById('result'); - -export function fail(message) { - resultPre.classList.add('fail-result-pre'); - resultPre.innerHTML = 'FAIL' + (message ? '\n\n' + message : ''); - resultPre.hidden = false; -} - -export function pass() { - resultPre.classList.add('pass-result-pre'); - resultPre.innerHTML = 'PASS'; - resultPre.hidden = false; -}