test.js
4.04 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
var assert = require("assert");
describe('aaa', function() {
var aaa = require('./aaa');
describe("#unaliasResponseCode()", function() {
it('should return 68', function() {
assert.equal('68', aaa.unaliasResponseCode('01', '01:68'));
});
it('should return 68', function() {
assert.equal('68', aaa.unaliasResponseCode('68', '01:68'));
});
it('should return 00', function() {
assert.equal('00', aaa.unaliasResponseCode('00', '01:68'));
});
it('should return 40', function() {
assert.equal('40', aaa.unaliasResponseCode('40', ''));
});
it('should return 40', function() {
assert.equal('40', aaa.unaliasResponseCode('40', ''));
});
it('should return 40', function() {
assert.equal('40', aaa.unaliasResponseCode('40'));
});
});
});
describe('partner', function() {
var partner = require('./partner-scrappingkisel');
describe("#stockKeyword", function() {
it('should return 10K', function() {
assert.equal('10K', partner.stockKeyword('Telkomsel 10K'));
});
it('should return 20K', function() {
assert.equal('20K', partner.stockKeyword('Telkomsel 20K'));
});
it('should return 25K', function() {
assert.equal('25K', partner.stockKeyword('Telkomsel 25K'));
});
it('should return 50K', function() {
assert.equal('50K', partner.stockKeyword('Telkomsel 50K'));
});
it('should return 100K', function() {
assert.equal('100K', partner.stockKeyword('Telkomsel 100K'));
});
});
describe("#parseStock", function() {
it('should return 476', function() {
assert.equal(476, partner.parseStock('10K = 476; 20K = 598; 25K = 600; 50K = 700; 100K = 400; 150K = 0; 200K = 0; 300K = 0; 500K = 0', 'Telkomsel 10K'));
});
it('should return 598', function() {
assert.equal(598, partner.parseStock('10K = 476; 20K = 598; 25K = 600; 50K = 700; 100K = 400; 150K = 0; 200K = 0; 300K = 0; 500K = 0', 'Telkomsel 20K'));
});
it('should return 0', function() {
assert.equal(0, partner.parseStock('10K = 476; 20K = 598; 25K = 600; 50K = 700; 100K = 400; 150K = 0; 200K = 0; 300K = 0; 500K = 0', 'Telkomsel 200K'));
});
it('should return 0', function() {
assert.equal(0, partner.parseStock('10K = 476; 20K = 598; 25K = 600; 50K = 700; 100K = 400; 150K = 0; 200K = 0; 300K = 0; 500K = 0', 'Telkomsel 2000K'));
});
it('should return 0', function() {
assert.equal(0, partner.parseStock('10K = 476; 20K = 598; 25K = 600; 50K = 700; 100K = 400; 150K = 0; 200K = 0; 300K = 0; 500K = 0', 'Telkomsel 2000'));
});
it('should return 0', function() {
assert.equal(0, partner.parseStock('', 'Telkomsel 2000'));
});
it('should return 0', function() {
assert.equal(0, partner.parseStock('10K = 476; 20K = 598; 25K = 600; 50K = 700; 100K = 400; 150K = 0; 200K = 0; 300K = 0; 500K = 0', ''));
});
});
describe('#productsWithout', function () {
it('should return S10,S20,S50,S100', function() {
assert.equal('S10,S20,S50,S100', partner.productsWithout('S25', 'S10,S20,S25,S50,S100'));
});
it('should return S10,S20,S25,S50', function() {
assert.equal('S10,S20,S25,S50', partner.productsWithout('S100', 'S10,S20,S25,S50,S100'));
});
it('should return S20,S25,S50,S100', function() {
assert.equal('S20,S25,S50,S100', partner.productsWithout('S10', 'S10,S20,S25,S50,S100'));
});
it('should return S10,S20,S25,S50', function() {
assert.equal('S10,S20,S25,S50', partner.productsWithout('S100', 'S10,S20,S25,S50'));
});
});
});