@symbo.ls/sdk 2.34.22 → 2.34.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/sdk",
|
|
3
|
-
"version": "2.34.
|
|
3
|
+
"version": "2.34.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"test:unit-all": "cross-env NODE_ENV=$NODE_ENV npx tape src/services/tests/**/*.test.js | tap-spec"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@domql/element": "^2.34.
|
|
51
|
-
"@domql/utils": "^2.34.
|
|
50
|
+
"@domql/element": "^2.34.24",
|
|
51
|
+
"@domql/utils": "^2.34.24",
|
|
52
52
|
"@grafana/faro-web-sdk": "^1.19.0",
|
|
53
53
|
"@grafana/faro-web-tracing": "^1.19.0",
|
|
54
|
-
"@symbo.ls/router": "^2.34.
|
|
55
|
-
"@symbo.ls/socket": "^2.34.
|
|
54
|
+
"@symbo.ls/router": "^2.34.24",
|
|
55
|
+
"@symbo.ls/socket": "^2.34.24",
|
|
56
56
|
"acorn": "^8.14.0",
|
|
57
57
|
"acorn-walk": "^8.3.4",
|
|
58
58
|
"dexie": "^4.0.11",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"tap-spec": "^5.0.0",
|
|
76
76
|
"tape": "^5.9.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "4886a866c3adef97083fc36e3e4db40c1543054d"
|
|
79
79
|
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* eslint-disable no-undefined */
|
|
2
|
+
import test from 'tape'
|
|
3
|
+
import sinon from 'sinon'
|
|
4
|
+
import { BranchService } from '../../BranchService.js'
|
|
5
|
+
|
|
6
|
+
// #region Setup
|
|
7
|
+
const sandbox = sinon.createSandbox()
|
|
8
|
+
// #endregion
|
|
9
|
+
|
|
10
|
+
// #region Tests
|
|
11
|
+
test('getBranchChanges should return response data', async (t) => {
|
|
12
|
+
t.plan(1)
|
|
13
|
+
const responseStub = {
|
|
14
|
+
success: true,
|
|
15
|
+
data: 'Test data response'
|
|
16
|
+
}
|
|
17
|
+
const branchDataMock = {
|
|
18
|
+
name: 'Test_Branch_Name'
|
|
19
|
+
}
|
|
20
|
+
const testProjectId = 'Test Project ID'
|
|
21
|
+
const branchServiceStub = new BranchService()
|
|
22
|
+
sandbox.stub(branchServiceStub, '_requireReady').resolves()
|
|
23
|
+
sandbox.stub(branchServiceStub, '_request').resolves(responseStub)
|
|
24
|
+
const response = await branchServiceStub.getBranchChanges(
|
|
25
|
+
testProjectId,
|
|
26
|
+
branchDataMock.name
|
|
27
|
+
)
|
|
28
|
+
t.equal(
|
|
29
|
+
response,
|
|
30
|
+
responseStub.data,
|
|
31
|
+
'Actual response matches expected response'
|
|
32
|
+
)
|
|
33
|
+
sandbox.restore()
|
|
34
|
+
t.end()
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
function checkProjectIdValidation () {
|
|
38
|
+
const badData = [
|
|
39
|
+
{
|
|
40
|
+
testName: 'No Project ID'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
testName: 'Empty string',
|
|
44
|
+
projectId: ''
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
testName: 'False boolean value',
|
|
48
|
+
projectId: false
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
testName: 'Undefined value',
|
|
52
|
+
projectId: undefined
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
testName: 'Null value',
|
|
56
|
+
projectId: null
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
for (let ii = 0; ii < badData.length; ii++) {
|
|
60
|
+
test(`Project ID validation should throw an error when: ${badData[ii].testName} is passed in`, async (t) => {
|
|
61
|
+
t.plan(1)
|
|
62
|
+
const responseStub = {
|
|
63
|
+
success: true,
|
|
64
|
+
data: 'Test data response'
|
|
65
|
+
}
|
|
66
|
+
const branchDataMock = {
|
|
67
|
+
name: 'Test_Branch_Name'
|
|
68
|
+
}
|
|
69
|
+
const testProjectId = badData[ii].projectId
|
|
70
|
+
const branchServiceStub = new BranchService()
|
|
71
|
+
sandbox.stub(branchServiceStub, '_requireReady').resolves()
|
|
72
|
+
sandbox.stub(branchServiceStub, '_request').resolves(responseStub)
|
|
73
|
+
try {
|
|
74
|
+
await branchServiceStub.getBranchChanges(
|
|
75
|
+
testProjectId,
|
|
76
|
+
branchDataMock.name
|
|
77
|
+
)
|
|
78
|
+
t.fail('Project ID validation threw an error with an invalid value')
|
|
79
|
+
} catch (err) {
|
|
80
|
+
t.equal(
|
|
81
|
+
err.toString(),
|
|
82
|
+
'Error: Project ID is required',
|
|
83
|
+
`Project ID validation successfully threw an error with: ${badData[ii].testName}`
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
sandbox.restore()
|
|
87
|
+
t.end()
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function checkBranchDataNameValidation () {
|
|
93
|
+
const badData = [
|
|
94
|
+
{
|
|
95
|
+
testName: 'Empty string',
|
|
96
|
+
name: ''
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
testName: 'False boolean value',
|
|
100
|
+
name: false
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
testName: 'Null value',
|
|
104
|
+
name: null
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
for (let ii = 0; ii < badData.length; ii++) {
|
|
108
|
+
test(`Branch name validation should throw an error when: ${badData[ii].testName} is passed in`, async (t) => {
|
|
109
|
+
t.plan(1)
|
|
110
|
+
const responseStub = {
|
|
111
|
+
success: true,
|
|
112
|
+
data: 'Test data response'
|
|
113
|
+
}
|
|
114
|
+
const testProjectId = 'Test Project ID'
|
|
115
|
+
const branchServiceStub = new BranchService()
|
|
116
|
+
sandbox.stub(branchServiceStub, '_requireReady').resolves()
|
|
117
|
+
sandbox.stub(branchServiceStub, '_request').resolves(responseStub)
|
|
118
|
+
try {
|
|
119
|
+
await branchServiceStub.getBranchChanges(
|
|
120
|
+
testProjectId,
|
|
121
|
+
badData[ii].name
|
|
122
|
+
)
|
|
123
|
+
t.fail('Branch name validation threw an error with an invalid value')
|
|
124
|
+
} catch (err) {
|
|
125
|
+
t.equal(
|
|
126
|
+
err.toString(),
|
|
127
|
+
'Error: Branch name is required',
|
|
128
|
+
`Branch name validation successfully threw an error with: ${badData[ii].testName}`
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
sandbox.restore()
|
|
132
|
+
t.end()
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
checkBranchDataNameValidation()
|
|
138
|
+
checkProjectIdValidation()
|
|
139
|
+
// #endregion
|
|
140
|
+
|
|
141
|
+
// #region Cleanup
|
|
142
|
+
test('teardown', (t) => {
|
|
143
|
+
sandbox.restore()
|
|
144
|
+
t.end()
|
|
145
|
+
})
|
|
146
|
+
// #endregion
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* eslint-disable no-undefined */
|
|
2
|
+
import test from 'tape'
|
|
3
|
+
import sinon from 'sinon'
|
|
4
|
+
import { BranchService } from '../../BranchService.js'
|
|
5
|
+
|
|
6
|
+
// #region Setup
|
|
7
|
+
const sandbox = sinon.createSandbox()
|
|
8
|
+
// #endregion
|
|
9
|
+
|
|
10
|
+
// #region Tests
|
|
11
|
+
test('mergeBranch should return response data', async (t) => {
|
|
12
|
+
t.plan(1)
|
|
13
|
+
const responseStub = {
|
|
14
|
+
success: true,
|
|
15
|
+
data: 'Test data response'
|
|
16
|
+
}
|
|
17
|
+
const branchDataMock = {
|
|
18
|
+
name: 'Test_Branch_Name'
|
|
19
|
+
}
|
|
20
|
+
const testProjectId = 'Test Project ID'
|
|
21
|
+
const branchServiceStub = new BranchService()
|
|
22
|
+
sandbox.stub(branchServiceStub, '_requireReady').resolves()
|
|
23
|
+
sandbox.stub(branchServiceStub, '_request').resolves(responseStub)
|
|
24
|
+
const response = await branchServiceStub.mergeBranch(
|
|
25
|
+
testProjectId,
|
|
26
|
+
branchDataMock.name
|
|
27
|
+
)
|
|
28
|
+
t.equal(
|
|
29
|
+
response,
|
|
30
|
+
responseStub.data,
|
|
31
|
+
'Actual response matches expected response'
|
|
32
|
+
)
|
|
33
|
+
sandbox.restore()
|
|
34
|
+
t.end()
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
function checkProjectIdValidation () {
|
|
38
|
+
const badData = [
|
|
39
|
+
{
|
|
40
|
+
testName: 'No Project ID'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
testName: 'Empty string',
|
|
44
|
+
projectId: ''
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
testName: 'False boolean value',
|
|
48
|
+
projectId: false
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
testName: 'Undefined value',
|
|
52
|
+
projectId: undefined
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
testName: 'Null value',
|
|
56
|
+
projectId: null
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
for (let ii = 0; ii < badData.length; ii++) {
|
|
60
|
+
test(`Project ID validation should throw an error when: ${badData[ii].testName} is passed in`, async (t) => {
|
|
61
|
+
t.plan(1)
|
|
62
|
+
const responseStub = {
|
|
63
|
+
success: true,
|
|
64
|
+
data: 'Test data response'
|
|
65
|
+
}
|
|
66
|
+
const branchDataMock = {
|
|
67
|
+
name: 'Test_Branch_Name'
|
|
68
|
+
}
|
|
69
|
+
const testProjectId = badData[ii].projectId
|
|
70
|
+
const branchServiceStub = new BranchService()
|
|
71
|
+
sandbox.stub(branchServiceStub, '_requireReady').resolves()
|
|
72
|
+
sandbox.stub(branchServiceStub, '_request').resolves(responseStub)
|
|
73
|
+
try {
|
|
74
|
+
await branchServiceStub.mergeBranch(testProjectId, branchDataMock.name)
|
|
75
|
+
t.fail('Project ID validation threw an error with an invalid value')
|
|
76
|
+
} catch (err) {
|
|
77
|
+
t.equal(
|
|
78
|
+
err.toString(),
|
|
79
|
+
'Error: Project ID is required',
|
|
80
|
+
`Project ID validation successfully threw an error with: ${badData[ii].testName}`
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
sandbox.restore()
|
|
84
|
+
t.end()
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function checkBranchDataNameValidation () {
|
|
90
|
+
const badData = [
|
|
91
|
+
{
|
|
92
|
+
testName: 'No name'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
testName: 'Empty string',
|
|
96
|
+
name: ''
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
testName: 'False boolean value',
|
|
100
|
+
name: false
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
testName: 'Undefined value',
|
|
104
|
+
name: undefined
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
testName: 'Null value',
|
|
108
|
+
name: null
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
for (let ii = 0; ii < badData.length; ii++) {
|
|
112
|
+
test(`Branch name validation should throw an error when: ${badData[ii].testName} is passed in`, async (t) => {
|
|
113
|
+
t.plan(1)
|
|
114
|
+
const responseStub = {
|
|
115
|
+
success: true,
|
|
116
|
+
data: 'Test data response'
|
|
117
|
+
}
|
|
118
|
+
const testProjectId = 'Test Project ID'
|
|
119
|
+
const branchServiceStub = new BranchService()
|
|
120
|
+
sandbox.stub(branchServiceStub, '_requireReady').resolves()
|
|
121
|
+
sandbox.stub(branchServiceStub, '_request').resolves(responseStub)
|
|
122
|
+
try {
|
|
123
|
+
await branchServiceStub.mergeBranch(testProjectId, badData[ii].name)
|
|
124
|
+
t.fail('Branch name validation threw an error with an invalid value')
|
|
125
|
+
} catch (err) {
|
|
126
|
+
t.equal(
|
|
127
|
+
err.toString(),
|
|
128
|
+
'Error: Source branch name is required',
|
|
129
|
+
`Branch name validation successfully threw an error with: ${badData[ii].testName}`
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
sandbox.restore()
|
|
133
|
+
t.end()
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
checkBranchDataNameValidation()
|
|
139
|
+
checkProjectIdValidation()
|
|
140
|
+
// #endregion
|
|
141
|
+
|
|
142
|
+
// #region Cleanup
|
|
143
|
+
test('teardown', (t) => {
|
|
144
|
+
sandbox.restore()
|
|
145
|
+
t.end()
|
|
146
|
+
})
|
|
147
|
+
// #endregion
|