Created
October 27, 2020 23:15
-
-
Save gagregrog/f849656a2bbd1cf885c1171f2ef00e79 to your computer and use it in GitHub Desktop.
Piecing it all together
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const io = require('./io'); | |
const alert = require('./alert'); | |
const getTime = require('./time'); | |
const parseHtml = require('./html'); | |
const areEqual = require('./compare'); | |
const getTestResultsAsHtml = require('./request'); | |
const processOne = async (config) => { | |
const html = await getTestResultsAsHtml(config); | |
const fields = parseHtml(html); | |
const lastResults = await io.getLastResults(); | |
if (!areEqual(fields, lastResults)) { | |
await io.updateResults(fields); | |
console.log('__STATUS_CHANGE__', fields, '\n'); | |
await alert(); | |
} else { | |
console.log(`Found same results at`, getTime(), '\n'); | |
} | |
}; | |
module.exports = processOne; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment