Generation

testsWed, 07 Dec 2022

function getXMLHttpRequest(callback) { var req = new XMLHttpRequest(); req.onreadystatechange = function() { if (req.readyState !== this.DONE) { return false; } if (req.status !== 200) { console.log("status " + req.status); return false; } return callback(req.response); } req.open("GET", "https://api.chucknorris.io/jokes/random", true); req.send(); }

import unittest class TestGetJoke(unittest.TestCase): def test_get_joke(self): self.assertTrue(get_joke())

Questions about programming?Chat with your personal AI assistant