Skip to content

Commit

Permalink
Adding unit tests (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xotl authored Nov 27, 2022
1 parent 942d530 commit 186da15
Show file tree
Hide file tree
Showing 7 changed files with 3,678 additions and 2,073 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/build.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build
name: Tests

on:
push:
Expand All @@ -16,19 +16,28 @@ jobs:
environment:
name: testing

env:
WEB_HOOK_URL: ${{ secrets.WEB_HOOK_URL }}

strategy:
matrix:
node-version: [10.x]
node-version: [14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm start
env:
WEB_HOOK_URL: ${{ secrets.WEB_HOOK_URL }}

- name: Install app dependencies
run: npm ci

- name: Run unit tests
run: npm test

- name: Test whole flow by publishing to Discord
run: npm start
5 changes: 4 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
'use strict'

const { getWaifu } = require('./utils/puppeteerScrapper')
const weebhook = require('./utils/webhook')
const url = process.env.WEB_HOOK_URL

async function main() {
const waifuObj = await getWaifu()
await weebhook.sendDiscordMessage(waifuObj)
await weebhook.sendDiscordMessage(waifuObj, url)
}

main()
Loading

0 comments on commit 186da15

Please sign in to comment.