Skip to content

Commit 3b63ee1

Browse files
committed
Added temporary integration test
1 parent 2da8e3a commit 3b63ee1

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import * as fs from 'fs';
2+
import * as https from 'https';
3+
import * as child_process from 'child_process';
4+
5+
describe('temp tests', async () => {
6+
it('downloads and forks from s3', (done) => {
7+
fs.mkdirSync('/Library/Caches/codify/plugins', { recursive: true })
8+
9+
//fs.writeFileSync('/Library/Caches/codify/plugins/core-plugin.js', '')
10+
const file = fs.createWriteStream('/Library/Caches/codify/plugins/core-plugin.js')
11+
12+
file.on('open', () => {
13+
https.get('https://codify-plugin-library.s3.amazonaws.com/codify-core/index.js', (res) => {
14+
res.pipe(file)
15+
})
16+
})
17+
18+
file.on('finish', async () => {
19+
file.close()
20+
console.log('Download complete')
21+
22+
console.log('Starting child_process')
23+
const child = child_process.fork('/Library/Caches/codify/plugins/core-plugin.js')
24+
child.send({
25+
cmd: 'plan',
26+
data: {
27+
type: 'abc',
28+
name: 'nae'
29+
}
30+
})
31+
32+
let sleep = async ms => new Promise(resolve => setTimeout(resolve, ms));
33+
await sleep(5000)
34+
35+
done()
36+
})
37+
})
38+
})

codify-core/src/plugins/ipc-bridge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { PluginMessage } from './entities/message';
77
type Resolve = (value: unknown) => void;
88
type Reject = (reason?: Error) => void;
99

10-
const resultFunctionName = (cmd: string) => `${cmd}Result`;
10+
const resultFunctionName = (cmd: string) => `${cmd}_Result`;
1111

1212
export class PluginIpcBridge {
1313
process: ChildProcess;

0 commit comments

Comments
 (0)