M README.md => README.md +3 -1
@@ 14,5 14,7 @@ PHONE_NUM=""
```
Make sure the following packages are installed:
-- xmppipe
+- go-sendxmpp with this patch https://salsa.debian.org/mdosch/go-sendxmpp/-/merge_requests/4
- shellspec
+
+- OLD: not working command xmppipe --chat "$PHONE_NUM@cheogram.com" <> /tmp/xmpp > /tmp/outdata &
M lib/text.sh => lib/text.sh +13 -5
@@ 3,13 3,21 @@
recieving() {
. ./.secrets
- RECIEVE_ME="TESTDATA - Testing plain text at $(date)"
- echo "$RECIEVE_ME" | go-sendxmpp "$PHONE_NUM@cheogram.com"
+ RECIEVE_ME="$1"
+ echo "$RECIEVE_ME" | ./go-sendxmpp "$PHONE_NUM@cheogram.com"
sleep 4s
- RECIEVED="$(tail -n 2 "$XDG_DATA_HOME/sxmo/modem/$CHEOGRAM_NUM/sms.txt" | grep -v "^$")"
+ tail -n 2 "$XDG_DATA_HOME/sxmo/modem/$CHEOGRAM_NUM/sms.txt" | head -n 1
+}
- [ "$RECIEVE_ME" = "$RECIEVED" ] && echo "Good" && return 0
- [ "$RECIEVE_ME" != "$RECIEVED" ] && echo "Bad" && return 1
+sending() {
+ . ./.secrets
+ SEND_ME="$1"
+ sxmo_modemsendsms.sh "$CHEOGRAM_NUM" "$SEND_ME" > /dev/null
+ # TODO: Why do I need to run the following command outside of shellspec?
+ # outside of shellspec ./go-sendxmpp writes the text to file and exits with exit code 0
+ #./go-sendxmpp -li "$PHONE_NUM@cheogram.com" 2> sendingdat &
+ sleep 4s
+ tail -n 1 sendingdat
}
M spec/text_spec.sh => spec/text_spec.sh +10 -4
@@ 1,10 1,16 @@
#!/bin/sh
-# Simple test script for shellspec
+
+%const NAME: value
+% DATE: "$(date) $(cat /dev/urandom | base64 | head -n 1)"
Describe 'text.sh'
Include lib/text.sh
- It 'Can receive plaintext message'
- When call recieving ShellSpec
- The output should equal 'Good'
+ It 'Can receive plaintext message pinephone'
+ When call recieving "TESTDATA - Testing plain text at $DATE" ShellSpec
+ The output should equal "TESTDATA - Testing plain text at $DATE"
+ End
+ It 'Can send plaintext message from pinephone'
+ When call sending "TESTDATA - Testing plain text at $DATE" ShellSpec
+ The output should equal "TESTDATA - Testing plain text at $DATE"
End
End