@unchainedshop/core-users 3.1.1 → 3.1.2
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": "@unchainedshop/core-users",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"main": "lib/users-index.js",
|
|
5
5
|
"types": "lib/users-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"build": "tsc -b",
|
|
10
10
|
"prepublishOnly": "npm run clean && npm run build",
|
|
11
11
|
"watch": "tsc -w",
|
|
12
|
-
"test": "
|
|
13
|
-
"test:watch": "
|
|
12
|
+
"test": "tsx --test",
|
|
13
|
+
"test:watch": "tsx --test --watch"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
@@ -50,8 +50,7 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.13.4",
|
|
52
52
|
"fido2-lib": "^3.5.3",
|
|
53
|
-
"
|
|
54
|
-
"ts-jest": "^29.2.5",
|
|
53
|
+
"tsx": "^4.19.2",
|
|
55
54
|
"typescript": "^5.7.3"
|
|
56
55
|
}
|
|
57
56
|
}
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert';
|
|
1
3
|
import { buildFindSelector } from './configureUsersModule.js';
|
|
2
4
|
|
|
3
5
|
describe('buildFindSelector', () => {
|
|
4
6
|
it('Return the correct filter when no parameter is passed', () => {
|
|
5
|
-
|
|
7
|
+
assert.deepStrictEqual(buildFindSelector({}), { deleted: null, guest: { $in: [false, null] } });
|
|
6
8
|
});
|
|
7
9
|
it('Return the correct filter when no parameter is passed queryString and includeGuest: true', () => {
|
|
8
|
-
|
|
10
|
+
assert.deepStrictEqual(buildFindSelector({ queryString: 'Hello world', includeGuests: true }), {
|
|
9
11
|
deleted: null,
|
|
10
12
|
$text: { $search: 'Hello world' },
|
|
11
13
|
});
|
|
12
14
|
});
|
|
13
15
|
|
|
14
16
|
it('Should include additional user field selector in addition too queryString and includeGuests', () => {
|
|
15
|
-
|
|
17
|
+
assert.deepStrictEqual(
|
|
16
18
|
buildFindSelector({
|
|
17
19
|
queryString: 'Hello world',
|
|
18
20
|
includeGuests: false,
|
|
19
21
|
'profile.displayName': 'mikael',
|
|
20
22
|
}),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
{
|
|
24
|
+
'profile.displayName': 'mikael',
|
|
25
|
+
deleted: null,
|
|
26
|
+
guest: { $in: [false, null] },
|
|
27
|
+
$text: { $search: 'Hello world' },
|
|
28
|
+
},
|
|
29
|
+
);
|
|
27
30
|
});
|
|
28
31
|
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert';
|
|
1
3
|
import { removeConfidentialServiceHashes } from './configureUsersModule.js';
|
|
2
4
|
import user from '../../tests/mock/user-mock.js';
|
|
3
5
|
import { User } from '../db/UsersCollection.js';
|
|
4
6
|
|
|
5
7
|
describe('removeConfidentialServiceHashes', () => {
|
|
6
8
|
it('Should remove sensitive user credentials ', () => {
|
|
7
|
-
|
|
9
|
+
assert.notStrictEqual(user.services, undefined);
|
|
8
10
|
removeConfidentialServiceHashes(user as unknown as User);
|
|
9
|
-
|
|
11
|
+
assert.strictEqual(user.services, undefined);
|
|
10
12
|
});
|
|
11
13
|
});
|
package/jest.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
|
2
|
-
export default {
|
|
3
|
-
preset: 'ts-jest/presets/default-esm', // or other ESM presets
|
|
4
|
-
testEnvironment: 'node',
|
|
5
|
-
extensionsToTreatAsEsm: ['.ts'],
|
|
6
|
-
transform: {
|
|
7
|
-
'^.+\\.tsx?$': [
|
|
8
|
-
'ts-jest',
|
|
9
|
-
{
|
|
10
|
-
useESM: true,
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
},
|
|
14
|
-
moduleNameMapper: {
|
|
15
|
-
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
16
|
-
},
|
|
17
|
-
};
|