-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
44 lines (40 loc) · 1.22 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const { expect } = require('chai')
const { R } = require('./dist/bundle')
describe('R', () => {
describe('#call', () => {
it('should add two numbers', done => {
let r = new R('./test_files/add.R')
r.data(2, 3)
r.call()
.then(result => {
expect(result).to.equal(5)
done()
})
.catch(e => console.log('err : ', e))
})
it('should return what was passed', done => {
let r = new R('./test_files/return_immediate.R')
r.data({stuff: [1, 2, 9999999]}, 'hello', 99.9)
r.call()
.then(result => {
expect(result).to.deep.equal([{stuff: [1, 2, 9999999]}, 'hello', 99.9])
done()
})
.catch(e => console.log('err : ', e))
})
})
describe('#callSync', () => {
it('should add two numbers', () => {
let r = new R('./test_files/add.R')
r.data(2, 3)
let result = r.callSync()
expect(result).to.equal(5)
})
it('should return what was passed', () => {
let r = new R('./test_files/return_immediate.R')
r.data({stuff: [1, 2, 9999999]}, 'hello', 99.9)
let result = r.callSync()
expect(result).to.deep.equal([{stuff: [1, 2, 9999999]}, 'hello', 99.9])
})
})
})