Skip to content

Commit 8a32aee

Browse files
committed
Linting.
1 parent 0f7ad61 commit 8a32aee

File tree

3 files changed

+9129
-8968
lines changed

3 files changed

+9129
-8968
lines changed

.eslintrc.js

+24-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
module.exports = {
2-
'env': {
3-
'es2021': true,
4-
'node': true,
5-
},
6-
'extends': [
7-
'google',
8-
],
9-
'overrides': [
10-
],
11-
'parserOptions': {
12-
'ecmaVersion': 'latest',
13-
'sourceType': 'module',
14-
},
15-
'plugins': [
16-
],
17-
'rules': {
18-
},
2+
'env': {
3+
'es2021': true,
4+
'node': true,
5+
},
6+
'extends': [
7+
'google',
8+
],
9+
'overrides': [
10+
],
11+
'parserOptions': {
12+
'ecmaVersion': 'latest',
13+
'sourceType': 'script',
14+
},
15+
'plugins': [
16+
],
17+
'rules': {
18+
'linebreak-style': 'off',
19+
'max-len': 'off',
20+
'no-invalid-this': 'off',
21+
'indent': ['error', 4],
22+
'prefer-const': 'off',
23+
'require-jsdoc': 'off',
24+
'camelcase': 'off',
25+
},
1926
};

src/main/server/skyId.test.js

+28-45
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,53 @@
1-
let axios = require("axios");
2-
let FormData = require("form-data");
3-
let chai = require("chai");
4-
const EcCrypto = require("cassproject/src/com/eduworks/ec/crypto/EcCrypto");
5-
const EcAes = require("cassproject/src/com/eduworks/ec/crypto/EcAes");
6-
const EcRemoteLinkedData = require("cassproject/src/org/cassproject/schema/general/EcRemoteLinkedData");
7-
const EcRemoteIdentityManager = require("cassproject/src/org/cassproject/ebac/identity/remote/EcRemoteIdentityManager");
8-
const EcIdentityManager = require("cassproject/src/org/cassproject/ebac/identity/EcIdentityManager");
9-
const EcIdentity = require("cassproject/src/org/cassproject/ebac/identity/EcIdentity");
10-
const EcPpk = require("cassproject/src/com/eduworks/ec/crypto/EcPpk");
1+
global.axios = require('axios');
2+
let chai = require('chai');
3+
const EcAes = require('cassproject/src/com/eduworks/ec/crypto/EcAes');
4+
const EcRemoteIdentityManager = require('cassproject/src/org/cassproject/ebac/identity/remote/EcRemoteIdentityManager');
5+
const EcIdentityManager = require('cassproject/src/org/cassproject/ebac/identity/EcIdentityManager');
6+
const EcIdentity = require('cassproject/src/org/cassproject/ebac/identity/EcIdentity');
7+
const EcPpk = require('cassproject/src/com/eduworks/ec/crypto/EcPpk');
118

12-
let hrtime = function() {
13-
try {
14-
return [Math.round(performance.now()/1000), performance.now() * 1000];
15-
} catch (e) {
16-
// Eat quietly.
17-
}
18-
return process.hrtime();
19-
};
9+
let assert = chai.assert;
2010

21-
var should = chai.should();
22-
var expect = chai.expect;
23-
var assert = chai.assert;
24-
25-
26-
describe("SkyID Adapter", function() {
11+
describe('SkyID Adapter', function() {
2712
this.timeout(30000);
2813
let username = EcAes.newIv(6);
2914
let password = EcAes.newSecret(6);
3015
let newPassword = EcAes.newSecret(6);
31-
let name = "Test User";
32-
let email = username + "@test.cassproject.org";
16+
let name = 'Test User';
3317
let ident = null;
3418

3519
it('create user', async () => {
3620
let rld = new EcRemoteIdentityManager();
37-
rld.server = "http://localhost/api/";
38-
await rld.configureFromServer(null,null);
39-
rld.startLogin(username,password);
21+
rld.server = 'http://localhost/api/';
22+
await rld.configureFromServer(null, null);
23+
rld.startLogin(username, password);
4024
let im = new EcIdentityManager();
41-
await rld.create(null,null,im);
25+
await rld.create(null, null, im);
4226
im = await rld.fetch();
4327
ident = new EcIdentity();
44-
ident.ppk = await EcPpk.generateKeyAsync(null,null);
28+
ident.ppk = await EcPpk.generateKeyAsync(null, null);
4529
ident.displayName = name;
4630
im.addIdentity(ident);
47-
await rld.commit(null,null,im);
31+
await rld.commit(null, null, im);
4832
}).timeout(2000);
4933

5034
it('change password', async () => {
5135
let rld = new EcRemoteIdentityManager();
52-
rld.server = "http://localhost/api/";
53-
await rld.configureFromServer(null,null);
54-
rld.startLogin(username,password);
36+
rld.server = 'http://localhost/api/';
37+
await rld.configureFromServer(null, null);
38+
rld.startLogin(username, password);
5539
let im = await rld.fetch();
56-
assert.equal(im.ids[0].ppk.toPem(),ident.ppk.toPem());
57-
rld.changePassword(username,password,newPassword);
58-
await rld.commit(null,null,im);
40+
assert.equal(im.ids[0].ppk.toPem(), ident.ppk.toPem());
41+
rld.changePassword(username, password, newPassword);
42+
await rld.commit(null, null, im);
5943
}).timeout(2000);
60-
44+
6145
it('load user', async () => {
6246
let rld = new EcRemoteIdentityManager();
63-
rld.server = "http://localhost/api/";
64-
await rld.configureFromServer(null,null);
65-
rld.startLogin(username,newPassword);
47+
rld.server = 'http://localhost/api/';
48+
await rld.configureFromServer(null, null);
49+
rld.startLogin(username, newPassword);
6650
let im = await rld.fetch();
67-
assert.equal(im.ids[0].ppk.toPem(),ident.ppk.toPem());
51+
assert.equal(im.ids[0].ppk.toPem(), ident.ppk.toPem());
6852
}).timeout(2000);
69-
70-
});
53+
});

0 commit comments

Comments
 (0)