-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
61 lines (50 loc) · 1.3 KB
/
Copy pathscript.js
File metadata and controls
61 lines (50 loc) · 1.3 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
import http from 'k6/http';
import { sleep } from "k6";
const viewPost = (url) => {
var payload = JSON.stringify({
slug: "https://google.com",
referrer: "https://facebook.com",
browser: "IE",
auth: false,
userID: "12345"
});
const postParams = {
headers: {
'hbism': '5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5'
}
};
http.post(`${url}/views`, payload, postParams);
}
const conversionsPost = (url) => {
const conversions = new Array(20).fill().map((e,i) => {
return {
skuID: `${1000 * (i + 1)}`,
quantity: 2
}
});
var payload = JSON.stringify({
conversions,
type: 'purchase',
sessionID: '123456789',
referrer: "https://facebook.com",
browser: "IE",
auth: false,
userID: "12345"
});
const postParams = {
headers: {
'hbism': '5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5'
}
};
http.post(`${url}/conversions`, payload, postParams);
}
const conversionsGet = (url) => {
http.get(`${url}/conversions?skus=1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019`);
sleep(10);
}
export default function() {
const url = 'http://localhost:3004/';
new Array(20).fill().map((e,i) => {
conversionsGet(url);
});
}