@unchainedshop/core-enrollments 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 +4 -5
- package/src/module/buildFindSelector.test.ts +16 -12
- package/jest.config.js +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-enrollments",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"main": "lib/enrollments-index.js",
|
|
5
5
|
"types": "lib/enrollments-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",
|
|
@@ -39,8 +39,7 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/breejs__later": "^4.1.5",
|
|
41
41
|
"@types/node": "^22.13.4",
|
|
42
|
-
"
|
|
43
|
-
"ts-jest": "^29.2.5",
|
|
42
|
+
"tsx": "^4.19.2",
|
|
44
43
|
"typescript": "^5.7.3"
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -1,38 +1,42 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert';
|
|
1
3
|
import { buildFindSelector } from './configureEnrollmentsModule.js';
|
|
2
4
|
import { EnrollmentStatus } from '../db/EnrollmentsCollection.js';
|
|
3
5
|
|
|
4
6
|
describe('buildFindSelector', () => {
|
|
5
7
|
it('Should correct filter when passed status, userId and queryString', () => {
|
|
6
|
-
|
|
8
|
+
assert.deepStrictEqual(
|
|
7
9
|
buildFindSelector({
|
|
8
10
|
queryString: 'Hello World',
|
|
9
11
|
status: [EnrollmentStatus.ACTIVE],
|
|
10
12
|
userId: 'admin-id',
|
|
11
13
|
}),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
{
|
|
15
|
+
deleted: null,
|
|
16
|
+
status: { $in: ['ACTIVE'] },
|
|
17
|
+
userId: 'admin-id',
|
|
18
|
+
$text: { $search: 'Hello World' },
|
|
19
|
+
},
|
|
20
|
+
);
|
|
18
21
|
});
|
|
22
|
+
|
|
19
23
|
it('Should correct filter when passed userId and queryString', () => {
|
|
20
|
-
|
|
24
|
+
assert.deepStrictEqual(buildFindSelector({ queryString: 'Hello World', userId: 'admin-id' }), {
|
|
21
25
|
deleted: null,
|
|
22
26
|
userId: 'admin-id',
|
|
23
27
|
$text: { $search: 'Hello World' },
|
|
24
28
|
});
|
|
25
29
|
});
|
|
26
30
|
|
|
27
|
-
it('Should correct filter when passed
|
|
28
|
-
|
|
31
|
+
it('Should correct filter when passed queryString', () => {
|
|
32
|
+
assert.deepStrictEqual(buildFindSelector({ queryString: 'Hello World' }), {
|
|
29
33
|
deleted: null,
|
|
30
34
|
$text: { $search: 'Hello World' },
|
|
31
35
|
});
|
|
32
36
|
});
|
|
33
37
|
|
|
34
|
-
it('Should correct filter when passed
|
|
35
|
-
|
|
38
|
+
it('Should correct filter when passed no argument', () => {
|
|
39
|
+
assert.deepStrictEqual(buildFindSelector({}), {
|
|
36
40
|
deleted: null,
|
|
37
41
|
});
|
|
38
42
|
});
|
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
|
-
};
|