Skip to content

Commit 2e98c2c

Browse files
committed
Split tests
1 parent 00c9e40 commit 2e98c2c

3 files changed

Lines changed: 54 additions & 37 deletions

File tree

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
1-
import Onyx from '../../dist/Onyx';
2-
import type {Collection, KeyValueMapping, NullishDeep, OnyxInput, OnyxUpdate} from '../../dist/types';
3-
4-
const ONYX_KEYS = {
5-
TEST_KEY: 'test',
6-
COLLECTION: {
7-
TEST_KEY: 'test_',
8-
},
9-
} as const;
10-
11-
type OnyxValues = {
12-
[ONYX_KEYS.TEST_KEY]: string;
13-
};
14-
15-
type OnyxCollectionValues = {
16-
[ONYX_KEYS.COLLECTION.TEST_KEY]: {str: string};
17-
};
18-
19-
declare module '../../dist/types' {
20-
interface CustomTypeOptions {
21-
keys: keyof OnyxValues;
22-
collectionKeys: keyof OnyxCollectionValues;
23-
values: OnyxValues & OnyxCollectionValues;
24-
}
25-
}
1+
import type {OnyxUpdate} from '../../dist/types';
2+
import ONYX_KEYS from './augmentation';
263

274
const onyxUpdate: OnyxUpdate = {
285
onyxMethod: 'set',
@@ -80,15 +57,3 @@ const onyxUpdateCollectionError3: OnyxUpdate = {
8057
},
8158
},
8259
};
83-
84-
Onyx.mergeCollection(ONYX_KEYS.COLLECTION.TEST_KEY, {
85-
// @ts-expect-error COLLECTION.TEST_KEY is invalid key, it is missing the suffix
86-
test_: {
87-
str: 'test3',
88-
},
89-
test_2: {
90-
str: 'test4',
91-
},
92-
// @ts-expect-error COLLECTION.TEST_KEY is object, not a number
93-
test_3: 2,
94-
});

tests/types/augmentation.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import '../../dist/types';
2+
3+
const ONYX_KEYS = {
4+
TEST_KEY: 'test',
5+
COLLECTION: {
6+
TEST_KEY: 'test_',
7+
},
8+
} as const;
9+
10+
type OnyxValues = {
11+
[ONYX_KEYS.TEST_KEY]: string;
12+
};
13+
14+
type OnyxCollectionValues = {
15+
[ONYX_KEYS.COLLECTION.TEST_KEY]: {str: string};
16+
};
17+
18+
declare module '../../dist/types' {
19+
interface CustomTypeOptions {
20+
keys: keyof OnyxValues;
21+
collectionKeys: keyof OnyxCollectionValues;
22+
values: OnyxValues & OnyxCollectionValues;
23+
}
24+
}
25+
26+
export default ONYX_KEYS;

tests/types/mergeCollection.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import Onyx from '../../dist/Onyx';
2+
import ONYX_KEYS from './augmentation';
3+
4+
Onyx.mergeCollection(ONYX_KEYS.COLLECTION.TEST_KEY, {
5+
test_1: {
6+
str: 'test3',
7+
},
8+
test_2: {
9+
str: 'test4',
10+
},
11+
test_3: {
12+
str: 'test5',
13+
},
14+
});
15+
16+
Onyx.mergeCollection(ONYX_KEYS.COLLECTION.TEST_KEY, {
17+
// @ts-expect-error COLLECTION.TEST_KEY is invalid key, it is missing the suffix
18+
test_: {
19+
str: 'test3',
20+
},
21+
test_2: {
22+
str: 'test4',
23+
},
24+
// @ts-expect-error COLLECTION.TEST_KEY is object, not a number
25+
test_3: 2,
26+
});

0 commit comments

Comments
 (0)