Skip to content

Commit d5a6d22

Browse files
fix failing tests
1 parent fde2dc6 commit d5a6d22

File tree

8 files changed

+393
-224
lines changed

8 files changed

+393
-224
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ module.exports = {
275275
"max-len": [
276276
"error",
277277
{
278-
"code": 140
278+
"code": 160
279279
}
280280
],
281281
"max-lines": "off",

package-lock.json

Lines changed: 369 additions & 202 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@
3535
"devDependencies": {
3636
"@types/google-protobuf": "^3.15.12",
3737
"@types/jest": "^29.5.12",
38-
"@types/node": "^20.14.2",
39-
"@typescript-eslint/eslint-plugin": "^7.13.0",
40-
"@typescript-eslint/eslint-plugin-tslint": "^7.0.2",
41-
"@typescript-eslint/parser": "^7.13.0",
38+
"@types/node": "^20.14.4",
39+
"@typescript-eslint/eslint-plugin": "^7.13.1",
40+
"@typescript-eslint/parser": "^7.13.1",
4241
"coveralls": "^3.1.1",
4342
"eslint": "^8.57.0",
4443
"eslint-plugin-import": "^2.29.1",
@@ -63,8 +62,11 @@
6362
"dependencies": {
6463
"@grpc/grpc-js": "^1.10.9",
6564
"@types/url-parse": "^1.4.11",
65+
"@typescript-eslint/eslint-plugin-tslint": "^6.21.0",
66+
"dgraph-js": "^21.3.1",
6667
"eslint-plugin-lodash": "^7.4.0",
6768
"google-protobuf": "^3.21.2",
69+
"grpc": "^1.24.11",
6870
"is-base64": "^1.1.0",
6971
"url-parse": "^1.5.10"
7072
}

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class DgraphClient {
4848

4949
const c = this.anyClient();
5050
let payload: messages.Payload;
51-
const operation = async (): Promise<messages.Payload> => c.alter(op, metadata, options);
51+
const operation = async () => c.alter(op, metadata, options);
5252
try {
5353
payload = await operation();
5454
} catch (e) {

src/clientStubFromSlash.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ const PORT = "443";
1111
export function clientStubFromSlashGraphQLEndpoint(
1212
graphqlEndpoint: string,
1313
apiKey: string,
14-
): DgraphClientStub {
14+
) {
1515
return clientStubFromCloudEndpoint(graphqlEndpoint, apiKey);
1616
}
1717

1818
export function clientStubFromCloudEndpoint(
1919
graphqlEndpoint: string,
2020
apiKey: string,
21-
): DgraphClientStub {
21+
) {
2222
const url = new Url(graphqlEndpoint);
2323
const urlParts = url.host.split(".");
2424
const firstHalf = urlParts[0];

src/txn.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export class Txn {
217217

218218
let resp: types.Response;
219219
const c = this.dc.anyClient();
220-
const operation = async (): Promise<messages.Response> => c.query(req, metadata, options);
220+
const operation = async () => c.query(req, metadata, options);
221221
try {
222222
resp = types.createResponse(await operation());
223223
} catch (e) {
@@ -274,7 +274,7 @@ export class Txn {
274274
}
275275

276276
const c = this.dc.anyClient();
277-
const operation = async (): Promise<messages.TxnContext> =>
277+
const operation = async () =>
278278
c.commitOrAbort(this.ctx, metadata, options);
279279
try {
280280
await operation();
@@ -313,7 +313,7 @@ export class Txn {
313313

314314
this.ctx.setAborted(true);
315315
const c = this.dc.anyClient();
316-
const operation = async (): Promise<messages.TxnContext> =>
316+
const operation = async () =>
317317
c.commitOrAbort(this.ctx, metadata, options);
318318
try {
319319
await operation();

tests/clientStub.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as dgraph from "../src";
44

55
import { SERVER_ADDR, SERVER_CREDENTIALS, setup } from "./helper";
66

7-
function validateVersionObject(version: dgraph.Version): void {
7+
function validateVersionObject(version: dgraph.Version){
88
const tag = version.getTag();
99
expect(typeof tag).toEqual("string");
1010
expect(tag).toBeDefined();

tests/integration/acl.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { fail } from "assert";
12
import { exec } from "child_process";
23
import { promisify } from "util";
34

@@ -28,15 +29,15 @@ const MUTATE_PERMISSION_DENIED = new Error(`7 PERMISSION_DENIED:\
2829
const ALTER_PERMISSION_DENIED = new Error(`7 PERMISSION_DENIED:\
2930
unauthorized to alter following predicates: ${PRED} \n`);
3031

31-
async function cmd(command: string): Promise<void>{
32+
async function cmd(command: string){
3233
try {
3334
await execute(command);
3435
} catch (err) {
3536
fail(`Failed to execute command:\n\t${command}\nError: ${err}`);
3637
}
3738
}
3839

39-
async function insertSampleData(): Promise<void> {
40+
async function insertSampleData() {
4041
const txn = client.newTxn();
4142
const mu = new dgraph.Mutation();
4243
mu.setSetNquads(`
@@ -48,7 +49,7 @@ async function insertSampleData(): Promise<void> {
4849
expect(uid).toBeDefined();
4950
}
5051

51-
async function loginUser(): Promise<dgraph.DgraphClient> {
52+
async function loginUser() {
5253
const aclClientStub = createClientStub();
5354
try {
5455
await aclClientStub.login(USERID, USERPWD);
@@ -58,7 +59,7 @@ async function loginUser(): Promise<dgraph.DgraphClient> {
5859
return createClient(aclClientStub);
5960
}
6061

61-
async function aclSetup(): Promise<dgraph.DgraphClient> {
62+
async function aclSetup() {
6263
client = await setup();
6364
await setSchema(client, `
6465
${PRED}: string .
@@ -70,24 +71,23 @@ async function aclSetup(): Promise<dgraph.DgraphClient> {
7071
return loginUser();
7172
}
7273

73-
async function addUser(): Promise<void> {
74+
async function addUser() {
7475
const command = `dgraph acl -a \'${SERVER_ADDR}\' add -u \'${USERID}\' -p \'${USERPWD}\' --guardian-creds \'${GUARDIAN_CREDS}\'`;
7576
await cmd(command);
7677
}
7778

78-
async function addGroup(): Promise<void> {
79+
async function addGroup(){
7980
const command = `dgraph acl -a \'${SERVER_ADDR}\' add -g \'${DEV_GROUP}\' --guardian-creds \'${GUARDIAN_CREDS}\'`;
8081
await cmd(command);
8182
}
8283

83-
async function addUserToGroup(): Promise<void> {
84+
async function addUserToGroup() {
8485
const command = `dgraph acl -a \'${SERVER_ADDR}\' mod -u \'${USERID}\' -l \'${DEV_GROUP}\' --guardian-creds \'${GUARDIAN_CREDS}\'`;
8586
await cmd(command);
8687
}
8788

88-
async function changePermission(permission: number): Promise<void> {
89-
const command = `dgraph acl -a \'${SERVER_ADDR}\' mod -g \'${DEV_GROUP}\' -p \'${PRED}\' -m \'${permission}\'
90-
--guardian-creds \'${GUARDIAN_CREDS}\'`;
89+
async function changePermission(permission: number){
90+
const command = `dgraph acl -a \'${SERVER_ADDR}\' mod -g \'${DEV_GROUP}\' -p \'${PRED}\' -m \'${permission}\' --guardian-creds \'${GUARDIAN_CREDS}\'`;
9191
await cmd(command);
9292
await wait(WAIT_FOR_SIX_SECONDS);
9393
}

0 commit comments

Comments
 (0)