@unchainedshop/core-assortments 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-assortments",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "main": "lib/assortments-index.js",
5
5
  "types": "lib/assortments-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": "NODE_OPTIONS=--experimental-vm-modules jest --detectOpenHandles --forceExit",
13
- "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --detectOpenHandles --forceExit"
12
+ "test": "tsx --test",
13
+ "test:watch": "tsx --test --watch"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -38,8 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.13.4",
41
- "jest": "^29.7.0",
42
- "ts-jest": "^29.2.5",
41
+ "tsx": "^4.19.2",
43
42
  "typescript": "^5.7.3"
44
43
  }
45
44
  }
@@ -1,11 +1,13 @@
1
+ import { describe, it } from 'node:test';
1
2
  import { buildFindSelector } from './configureAssortmentsModule.js';
3
+ import assert from 'node:assert';
2
4
 
3
5
  describe('buildFindSelector', () => {
4
6
  it('Return the correct filter when passed no argument', () => {
5
- expect(buildFindSelector({})).toEqual({ isRoot: true, isActive: true, deleted: null });
7
+ assert.deepStrictEqual(buildFindSelector({}), { isRoot: true, isActive: true, deleted: null });
6
8
  });
7
9
  it('Return the correct filter when passed queryString, assortmentId, assortmentSelector, includeInactive, includeLeaves, slugs, tags', () => {
8
- expect(
10
+ assert.deepStrictEqual(
9
11
  buildFindSelector({
10
12
  queryString: 'hello world',
11
13
  assortmentIds: ['assortment-1', 'assortment-2'],
@@ -15,18 +17,19 @@ describe('buildFindSelector', () => {
15
17
  slugs: ['assortment-slug-1', 'assortment-slug-2'],
16
18
  tags: ['assortment-tag'],
17
19
  }),
18
- ).toEqual({
19
- sequence: 1,
20
- _id: { $in: ['assortment-1', 'assortment-2'] },
21
- slugs: { $in: ['assortment-slug-1', 'assortment-slug-2'] },
22
- tags: { $all: ['assortment-tag'] },
23
- deleted: null,
24
- $text: { $search: 'hello world' },
25
- });
20
+ {
21
+ sequence: 1,
22
+ _id: { $in: ['assortment-1', 'assortment-2'] },
23
+ slugs: { $in: ['assortment-slug-1', 'assortment-slug-2'] },
24
+ tags: { $all: ['assortment-tag'] },
25
+ deleted: null,
26
+ $text: { $search: 'hello world' },
27
+ },
28
+ );
26
29
  });
27
30
 
28
31
  it('Return the correct filter when passed queryString, assortmentId, assortmentSelector, includeInactive, includeLeaves, slugs', () => {
29
- expect(
32
+ assert.deepStrictEqual(
30
33
  buildFindSelector({
31
34
  queryString: 'hello world',
32
35
  assortmentIds: ['assortment-1', 'assortment-2'],
@@ -35,18 +38,19 @@ describe('buildFindSelector', () => {
35
38
  includeLeaves: true,
36
39
  slugs: ['assortment-slug-1', 'assortment-slug-2'],
37
40
  }),
38
- ).toEqual({
39
- sequence: 1,
40
- deleted: null,
41
+ {
42
+ sequence: 1,
43
+ deleted: null,
41
44
 
42
- _id: { $in: ['assortment-1', 'assortment-2'] },
43
- slugs: { $in: ['assortment-slug-1', 'assortment-slug-2'] },
44
- $text: { $search: 'hello world' },
45
- });
45
+ _id: { $in: ['assortment-1', 'assortment-2'] },
46
+ slugs: { $in: ['assortment-slug-1', 'assortment-slug-2'] },
47
+ $text: { $search: 'hello world' },
48
+ },
49
+ );
46
50
  });
47
51
 
48
52
  it('Return the correct filter when passed queryString, assortmentId, assortmentSelector, includeInactive, includeLeaves', () => {
49
- expect(
53
+ assert.deepStrictEqual(
50
54
  buildFindSelector({
51
55
  queryString: 'hello world',
52
56
  assortmentIds: ['assortment-1', 'assortment-2'],
@@ -54,65 +58,64 @@ describe('buildFindSelector', () => {
54
58
  includeInactive: true,
55
59
  includeLeaves: true,
56
60
  }),
57
- ).toEqual({
58
- sequence: 1,
59
- deleted: null,
60
-
61
- _id: { $in: ['assortment-1', 'assortment-2'] },
62
- $text: { $search: 'hello world' },
63
- });
61
+ {
62
+ sequence: 1,
63
+ deleted: null,
64
+ _id: { $in: ['assortment-1', 'assortment-2'] },
65
+ $text: { $search: 'hello world' },
66
+ },
67
+ );
64
68
  });
65
69
 
66
70
  it('Return the correct filter when passed queryString, assortmentId, assortmentSelector, includeInactive', () => {
67
- expect(
71
+ assert.deepStrictEqual(
68
72
  buildFindSelector({
69
73
  queryString: 'hello world',
70
74
  assortmentIds: ['assortment-1', 'assortment-2'],
71
75
  assortmentSelector: { sequence: 1 },
72
76
  includeInactive: true,
73
77
  }),
74
- ).toEqual({
75
- sequence: 1,
76
- deleted: null,
77
-
78
- _id: { $in: ['assortment-1', 'assortment-2'] },
79
- $text: { $search: 'hello world' },
80
- });
78
+ {
79
+ sequence: 1,
80
+ deleted: null,
81
+ _id: { $in: ['assortment-1', 'assortment-2'] },
82
+ $text: { $search: 'hello world' },
83
+ },
84
+ );
81
85
  });
82
86
  it('Return the correct filter when passed queryString, assortmentId, assortmentSelector', () => {
83
- expect(
87
+ assert.deepStrictEqual(
84
88
  buildFindSelector({
85
89
  queryString: 'hello world',
86
90
  assortmentIds: ['assortment-1', 'assortment-2'],
87
91
  assortmentSelector: { sequence: 1 },
88
92
  }),
89
- ).toEqual({
90
- sequence: 1,
91
- deleted: null,
92
-
93
- _id: { $in: ['assortment-1', 'assortment-2'] },
94
- $text: { $search: 'hello world' },
95
- });
93
+ {
94
+ sequence: 1,
95
+ deleted: null,
96
+ _id: { $in: ['assortment-1', 'assortment-2'] },
97
+ $text: { $search: 'hello world' },
98
+ },
99
+ );
96
100
  });
97
101
 
98
102
  it('Return the correct filter when passed assortmentId, assortmentSelector', () => {
99
- expect(
103
+ assert.deepStrictEqual(
100
104
  buildFindSelector({
101
105
  assortmentIds: ['assortment-1', 'assortment-2'],
102
106
  assortmentSelector: { sequence: 1 },
103
107
  }),
104
- ).toEqual({
105
- sequence: 1,
106
- deleted: null,
107
-
108
- _id: { $in: ['assortment-1', 'assortment-2'] },
109
- });
108
+ {
109
+ sequence: 1,
110
+ deleted: null,
111
+ _id: { $in: ['assortment-1', 'assortment-2'] },
112
+ },
113
+ );
110
114
  });
111
115
 
112
116
  it('Return the correct filter when passed assortmentSelector', () => {
113
- expect(buildFindSelector({ assortmentSelector: { sequence: 1 } })).toEqual({
117
+ assert.deepStrictEqual(buildFindSelector({ assortmentSelector: { sequence: 1 } }), {
114
118
  deleted: null,
115
-
116
119
  sequence: 1,
117
120
  });
118
121
  });
@@ -5,6 +5,8 @@ import {
5
5
  fillToSameLengthArray,
6
6
  fillUp,
7
7
  } from './zipTreeByDeepness.js';
8
+ import { describe, it } from 'node:test';
9
+ import assert from 'node:assert';
8
10
 
9
11
  describe('divideTreeByLevels', () => {
10
12
  it('should return the expected result', () => {
@@ -24,7 +26,7 @@ describe('divideTreeByLevels', () => {
24
26
  },
25
27
  ];
26
28
 
27
- expect(divideTreeByLevels(array)).toEqual(expected);
29
+ assert.deepStrictEqual(divideTreeByLevels(array), expected);
28
30
  });
29
31
  });
30
32
 
@@ -35,7 +37,7 @@ describe('fillUp', () => {
35
37
 
36
38
  const result = fillUp(arr, size);
37
39
 
38
- expect(result).toEqual([1, 2, 3, null, null]);
40
+ assert.deepStrictEqual(result, [1, 2, 3, null, null]);
39
41
  });
40
42
  });
41
43
 
@@ -46,7 +48,7 @@ describe('fillToSameLengthArray', () => {
46
48
 
47
49
  const result = fillToSameLengthArray(a, b);
48
50
 
49
- expect(result).toEqual([
51
+ assert.deepStrictEqual(result, [
50
52
  [1, 2, 3],
51
53
  [4, 5, null],
52
54
  ]);
@@ -61,6 +63,6 @@ describe('concatItemsByLevels', () => {
61
63
  { level: 1, items: ['e', 'f'] },
62
64
  ];
63
65
  const result = concatItemsByLevels(levelArray);
64
- expect(result.length).toBe(2);
66
+ assert.equal(result.length, 2);
65
67
  });
66
68
  });
@@ -1,11 +1,13 @@
1
1
  import { Tree } from '@unchainedshop/utils';
2
2
  import zipTreeBySimplyFlattening from './zipTreeBySimplyFlattening.js';
3
+ import { describe, it } from 'node:test';
4
+ import assert from 'node:assert';
3
5
 
4
6
  describe('zipTreeBySimplyFlattening', () => {
5
7
  it('should return the expected result', () => {
6
8
  const array: Tree<string> = ['a', ['b', ['c', 'd']], 'e'];
7
9
  const expected = ['a', 'b', 'c', 'd', 'e'];
8
10
 
9
- expect(zipTreeBySimplyFlattening(array)).toEqual(expected);
11
+ assert.deepStrictEqual(zipTreeBySimplyFlattening(array), expected);
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
- };