Skip to content

Commit d039f7e

Browse files
authored
Merge pull request #258 from terminusdb/fix_integration
Fix integration test, number return as string
2 parents 566e385 + 5b0da61 commit d039f7e

File tree

5 files changed

+51
-15
lines changed

5 files changed

+51
-15
lines changed

docs/api/accesscontrol.md

+18
Original file line numberDiff line numberDiff line change
@@ -707,3 +707,21 @@ accessControl.deleteAccessRequest("djjdshhsuuwewueueuiHYHYYW.......").then(resul
707707
console.log(result)
708708
})
709709
```
710+
711+
## getUserInfo
712+
##### accessControl.getUserInfo([orgName]) ⇒ <code>Promise</code>
713+
-- TerminusX API --
714+
Get the userinfo teams ownership and subscription
715+
716+
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
717+
718+
| Param | Type | Description |
719+
| --- | --- | --- |
720+
| [orgName] | <code>string</code> | The organization name. |
721+
722+
**Example**
723+
```javascript
724+
accessControl.getUserInfo().then(result=>{
725+
console.log(result)
726+
})
727+
```

docs/api/woqlclient.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1109,18 +1109,19 @@ client.getBranches()
11091109
```
11101110
11111111
## getCommitsLog
1112-
##### woqlClient.getCommitsLog([dbId]) ⇒ <code>Promise</code>
1112+
##### woqlClient.getCommitsLog([start], [count]) ⇒ <code>Promise</code>
11131113
get the database collections list
11141114
11151115
**Returns**: <code>Promise</code> - A promise that returns the call response object, or an Error if rejected.
11161116
1117-
| Param | Type | Description |
1118-
| --- | --- | --- |
1119-
| [dbId] | <code>string</code> | the database id |
1117+
| Param | Type | Default | Description |
1118+
| --- | --- | --- | --- |
1119+
| [start] | <code>number</code> | <code>0</code> | where to start printing the commit information in the log (starting from the head of the current branch) |
1120+
| [count] | <code>number</code> | <code>1</code> | The number of total commit log records to return |
11201121
11211122
**Example**
11221123
```javascript
1123-
client.getCommitsLog()
1124+
client.getCommitsLog(count=10)
11241125
```
11251126
11261127
## getPrefixes

integration_tests/create_database.test.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,33 @@ describe('Create a database, schema and insert data', () => {
3030
})
3131

3232
test('Insert Document Child Tom', async () => {
33-
const person = {"age":10,"name":"Tom","@type":"Child"}
33+
const person = {"age":"10","name":"Tom","@type":"Child"}
3434
const result = await client.addDocument(person);
3535
expect(result).toStrictEqual(["terminusdb:///data/Child/Tom" ]);
3636
})
3737

3838
test('Insert Document Child Anna', async () => {
39-
const person = {"age":20,"name":"Anna","@type":"Child"}
39+
const person = {"age":"20","name":"Anna","@type":"Child"}
4040
const result = await client.addDocument(person);
4141
expect(result).toStrictEqual(["terminusdb:///data/Child/Anna" ]);
4242
})
4343

4444
test('Insert Document Parent Tom Senior', async () => {
45-
const person = {"age":40,"name":"Tom Senior","@type":"Parent" , "has_child":"Child/Tom"}
45+
const person = {"age":"40","name":"Tom Senior","@type":"Parent" , "has_child":"Child/Tom"}
4646
const result = await client.addDocument(person);
4747
expect(result).toStrictEqual(["terminusdb:///data/Parent/Tom%20Senior" ]);
4848
})
4949

5050
test('Query Person by name', async () => {
5151
const queryTemplate = {"name":"Tom", "@type":"Person" }
5252
const result = await client.getDocument({query:queryTemplate});
53-
expect(result).toStrictEqual({ '@id': 'Child/Tom', '@type': 'Child', age: 10, name: 'Tom' });
53+
expect(result).toStrictEqual({ '@id': 'Child/Tom', '@type': 'Child', age: "10", name: 'Tom' });
5454
})
5555

5656
test('Query Person by ege', async () => {
57-
const queryTemplate = {"age":40, "@type":"Person" }
57+
const queryTemplate = {"age":"40", "@type":"Person" }
5858
const result = await client.getDocument({query:queryTemplate});
59-
expect(result).toStrictEqual({"@id": "Parent/Tom%20Senior", "age":40,"name":"Tom Senior","@type":"Parent" , "has_child":"Child/Tom"});
59+
expect(result).toStrictEqual({"@id": "Parent/Tom%20Senior", "age":"40","name":"Tom Senior","@type":"Parent" , "has_child":"Child/Tom"});
6060
})
6161

6262
const change_request = "change_request02";
@@ -72,7 +72,7 @@ describe('Create a database, schema and insert data', () => {
7272
})
7373

7474
test('Update Child Tom, link Parent', async () => {
75-
const childTom = { '@id': 'Child/Tom', '@type': 'Child', age: 10, name: 'Tom' , has_parent:"Parent/Tom%20Senior"}
75+
const childTom = { '@id': 'Child/Tom', '@type': 'Child', age: "10", name: 'Tom' , has_parent:"Parent/Tom%20Senior"}
7676
const result = await client.updateDocument(childTom);
7777
expect(result).toStrictEqual(["terminusdb:///data/Child/Tom" ]);
7878
})
@@ -108,7 +108,7 @@ describe('Create a database, schema and insert data', () => {
108108
expect(result).toStrictEqual({
109109
'@id': 'Child/Tom',
110110
'@type': 'Child',
111-
age: 10,
111+
age: "10",
112112
name: 'Tom',
113113
has_parent: 'Parent/Tom%20Senior'
114114
});

lib/accessControl.js

+17
Original file line numberDiff line numberDiff line change
@@ -968,4 +968,21 @@ AccessControl.prototype.deleteAccessRequest = function (acceId, orgName) {
968968
const org = orgName || this.defaultOrganization;
969969
return this.dispatch(`${this.baseURL}/organizations/${UTILS.encodeURISegment(org)}/access_requests/${acceId}`, CONST.DELETE);
970970
};
971+
972+
/**
973+
* -- TerminusX API --
974+
* Get the userinfo teams ownership and subscription
975+
* @param {string} [orgName] - The organization name.
976+
* @return {Promise} A promise that returns the call response object, or an Error if rejected.
977+
* @example
978+
* accessControl.getUserInfo().then(result=>{
979+
* console.log(result)
980+
* })
981+
*
982+
*/
983+
AccessControl.prototype.getUserInfo = function (userName) {
984+
const userNameUrl = userName || 'info';
985+
return this.dispatch(`${this.baseURL}/users/${UTILS.encodeURISegment(userNameUrl)}`, CONST.GET);
986+
};
987+
971988
module.exports = AccessControl;

lib/woqlClient.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1482,10 +1482,10 @@ WOQLClient.prototype.getBranches = function (dbId) {
14821482
* @example
14831483
* client.getCommitsLog(count=10)
14841484
*/
1485-
WOQLClient.prototype.getCommitsLog = function (start=0, count=1) {
1485+
WOQLClient.prototype.getCommitsLog = function (start = 0, count = 1) {
14861486
return this.dispatch(
14871487
CONST.GET,
1488-
this.connectionConfig.log() + `?start=${start}&count=${count}`,
1488+
`${this.connectionConfig.log()}?start=${start}&count=${count}`,
14891489
);
14901490
};
14911491

0 commit comments

Comments
 (0)