This commit is contained in:
parent
7b1295bb02
commit
6db650b609
4 changed files with 10 additions and 15 deletions
11
README.md
11
README.md
|
@ -1,5 +1,4 @@
|
||||||
# I-Ching
|
# I-Ching
|
||||||
|
|
||||||
The I-Ching (a.k.a. the *Book of Changes*) is an ancient method of divination based on
|
The I-Ching (a.k.a. the *Book of Changes*) is an ancient method of divination based on
|
||||||
cleromancy (assigning meaning to the generation of apparently random numbers.) Six numbers
|
cleromancy (assigning meaning to the generation of apparently random numbers.) Six numbers
|
||||||
between 6 and 9 are generated in order to create a hexagram, the meaning of which is
|
between 6 and 9 are generated in order to create a hexagram, the meaning of which is
|
||||||
|
@ -13,17 +12,21 @@ This app will send an I-Ching horoscope to the pre-configured mailhog instance i
|
||||||
This app uses the I-Ching library app https://github.com/Velfi/i-ching.git.
|
This app uses the I-Ching library app https://github.com/Velfi/i-ching.git.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
It is possible to configure the mail host and port.
|
Properties of the app can be configured in the file config.json. It is possible to configure the mail host and port.
|
||||||
It is also possible to configure the intervall of days between the sending of horoscopes and the time of sending. The default is to send one email every seven days at 8 am.
|
It is also possible to configure the intervall of days between the sending of horoscopes and the time of sending. The default is to send one email every seven days at 8 am.
|
||||||
|
|
||||||
## First Start
|
## First Start
|
||||||
The app can be deployed by running:
|
The app can be deployed by running:
|
||||||
|
|
||||||
kubectl apply -f deployment.yaml
|
```bash
|
||||||
|
$ kubectl apply -f deployment.yaml
|
||||||
|
```
|
||||||
|
|
||||||
When a pod with the app is initally started, one email will be sent to the configured receiver.
|
When a pod with the app is initally started, one email will be sent to the configured receiver.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
The Jest unit tests can be run with
|
The Jest unit tests can be run with
|
||||||
|
|
||||||
npm test
|
```bash
|
||||||
|
$ npm test
|
||||||
|
```
|
|
@ -1,11 +1,7 @@
|
||||||
import { html } from "./broker";
|
import { html } from "./broker";
|
||||||
import { test, beforeAll, afterAll } from "@jest/globals";
|
import { test, beforeAll, afterAll } from "@jest/globals";
|
||||||
|
|
||||||
/*jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
jest.spyOn(console, "log").mockImplementation(() => {});
|
|
||||||
});*/
|
|
||||||
|
|
||||||
test("Generate HTML for hexagram", () => {
|
test("Generate HTML for hexagram", () => {
|
||||||
expect(html("Hexagram No. 45 ䷬\nGathering Together [Massing]\n萃 (cuì)"))
|
expect(html("Hexagram No. 45 ䷬\nGathering Together [Massing]\n萃 (cuì)"))
|
||||||
|
@ -21,7 +17,3 @@ test("Generate HTML for images", () => {
|
||||||
expect(html("Images:\nOver the earth, the lake:\nThe image of Gathering Together.\nThus the superior man renews his weapons\nIn order to meet the unforseen."))
|
expect(html("Images:\nOver the earth, the lake:\nThe image of Gathering Together.\nThus the superior man renews his weapons\nIn order to meet the unforseen."))
|
||||||
.toBe("<p><h3>Images:</h3>Over the earth, the lake:<br>The image of Gathering Together.<br>Thus the superior man renews his weapons<br>In order to meet the unforseen.<br></p></div>");
|
.toBe("<p><h3>Images:</h3>Over the earth, the lake:<br>The image of Gathering Together.<br>Thus the superior man renews his weapons<br>In order to meet the unforseen.<br></p></div>");
|
||||||
});
|
});
|
||||||
|
|
||||||
/*afterAll(() => {
|
|
||||||
(console.log as jest.Mock).mockRestore();
|
|
||||||
});*/
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ async function sendEmail(content: string) {
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
host: config.mailHost,
|
host: config.mailHost,
|
||||||
port: config.mailPort,
|
port: config.mailPort,
|
||||||
secure: false // MailHog needs no encryption
|
secure: false
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "broker.js",
|
"main": "broker.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest --runInBand --detectOpenHandles --force-exit"
|
"test": "jest --no-cache --force-exit"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|
Loading…
Reference in a new issue