Skip to content

Commit d0e0a5e

Browse files
committed
add scripts that help test #1 and #2
message order produced by transcript reader does not make a difference.
1 parent 53712ca commit d0e0a5e

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

bin/test-tool.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env node
2+
const path = require('path');
3+
const [_bin, script, cmd, ...rest] = process.argv;
4+
5+
function help() {
6+
const app = path.basename(script);
7+
return `
8+
Usage: ${app} [cmd] [args]
9+
Examples
10+
Send a message:
11+
${app} send "555-555-5555" "hello world"
12+
Test the transcript reader:
13+
${app} tr /path/to/transcript.ichat
14+
`;
15+
}
16+
17+
if (cmd === "send") {
18+
const Client = require('../src/client');
19+
const client = new Client();
20+
const [to, body] = rest;
21+
client.sendMessage(to, 'iMessage', body);
22+
} else if (cmd === "tr") {
23+
const TR = require('../src/transcript-reader');
24+
const [filepath] = rest;
25+
TR(filepath).getMessages().map((message)=>{
26+
console.log(message.message);
27+
});
28+
} else {
29+
process.stdout.write(help());
30+
}

test/rapid-fire.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
./bin/test-tool.js send "keyvanfatehi@gmail.com" "first"
2+
./bin/test-tool.js send "keyvanfatehi@gmail.com" "second"
3+
./bin/test-tool.js send "keyvanfatehi@gmail.com" "third"

test/tr-order.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./bin/test-tool.js tr "/Users/keyvan/Library/Containers/com.apple.iChat/Data/Library/Messages/Archive/2017-05-12/keyvanfatehi@gmail.com on 2017-03-25 at 15.14.04.ichat"

0 commit comments

Comments
 (0)