@amityco/ts-sdk 0.0.1-beta.41.1 → 0.0.1-beta.42.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/dist/@types/core/model.d.ts +3 -1
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/domains/category.d.ts +1 -1
- package/dist/@types/domains/category.d.ts.map +1 -1
- package/dist/@types/domains/comment.d.ts +1 -1
- package/dist/@types/domains/comment.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +1 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/message.d.ts +1 -1
- package/dist/@types/domains/message.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +1 -1
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/domains/subChannel.d.ts +1 -1
- package/dist/@types/domains/subChannel.d.ts.map +1 -1
- package/dist/cache/utils/index.d.ts +1 -0
- package/dist/cache/utils/index.d.ts.map +1 -1
- package/dist/category/api/queryCategories.d.ts.map +1 -1
- package/dist/category/observers/liveCategories.d.ts.map +1 -1
- package/dist/channel/observers/liveChannel.d.ts.map +1 -1
- package/dist/channel/observers/liveChannels.d.ts.map +1 -1
- package/dist/comment/api/queryComments.d.ts.map +1 -1
- package/dist/comment/api/tests/queryComments.test.d.ts +2 -0
- package/dist/comment/api/tests/queryComments.test.d.ts.map +1 -0
- package/dist/comment/observers/liveComments.d.ts.map +1 -1
- package/dist/community/api/queryCommunities.d.ts.map +1 -1
- package/dist/community/observers/liveCommunities.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/identifyModel.d.ts.map +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/follow/api/getFollowInfo.d.ts.map +1 -1
- package/dist/follow/observers/index.d.ts +1 -0
- package/dist/follow/observers/index.d.ts.map +1 -1
- package/dist/follow/observers/liveFollowInfo.d.ts +21 -0
- package/dist/follow/observers/liveFollowInfo.d.ts.map +1 -0
- package/dist/follow/observers/tests/liveFollowInfo.test.d.ts +2 -0
- package/dist/follow/observers/tests/liveFollowInfo.test.d.ts.map +1 -0
- package/dist/index.cjs.js +112 -63
- package/dist/index.esm.js +112 -64
- package/dist/index.umd.js +4 -4
- package/dist/message/api/createMessage.d.ts +2 -1
- package/dist/message/api/createMessage.d.ts.map +1 -1
- package/dist/message/observers/liveMessages.d.ts.map +1 -1
- package/dist/message/utils/index.d.ts +3 -2
- package/dist/message/utils/index.d.ts.map +1 -1
- package/dist/post/api/queryPosts.d.ts.map +1 -1
- package/dist/post/observers/livePosts.d.ts.map +1 -1
- package/dist/subChannel/api/querySubChannels.d.ts.map +1 -1
- package/dist/subChannel/observers/liveSubChannels.d.ts.map +1 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/liveObject.d.ts +1 -1
- package/dist/utils/liveObject.d.ts.map +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +77 -0
- package/dist/utils/tests/dummy/comment.d.ts.map +1 -0
- package/dist/utils/tests/dummy/community.d.ts +1 -1
- package/dist/utils/tests/dummy/index.d.ts +1 -0
- package/dist/utils/tests/dummy/index.d.ts.map +1 -1
- package/dist/utils/tests/dummy/post.d.ts +0 -12
- package/dist/utils/tests/dummy/post.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/model.ts +3 -1
- package/src/@types/domains/category.ts +1 -1
- package/src/@types/domains/comment.ts +1 -1
- package/src/@types/domains/community.ts +1 -1
- package/src/@types/domains/message.ts +1 -1
- package/src/@types/domains/post.ts +1 -1
- package/src/@types/domains/subChannel.ts +1 -1
- package/src/cache/utils/index.ts +5 -2
- package/src/category/api/queryCategories.ts +2 -1
- package/src/category/observers/liveCategories.ts +3 -1
- package/src/category/observers/tests/liveCategories.test.ts +1 -3
- package/src/channel/api/tests/addChannelMembers.test.ts +13 -0
- package/src/channel/api/tests/queryChannelMembers.test.ts +1 -0
- package/src/channel/api/tests/removeChannelMembers.test.ts +9 -2
- package/src/channel/observers/liveChannel.ts +16 -1
- package/src/channel/observers/liveChannels.ts +11 -9
- package/src/comment/api/queryComments.ts +2 -1
- package/src/comment/api/tests/createComment.test.ts +17 -112
- package/src/comment/api/tests/queryComments.test.ts +147 -0
- package/src/comment/api/tests/updateComment.test.ts +14 -85
- package/src/comment/observers/liveComments.ts +12 -7
- package/src/community/api/queryCommunities.ts +2 -1
- package/src/community/api/test/queryCommunity.test.ts +30 -0
- package/src/community/observers/liveCommunities.ts +13 -7
- package/src/community/observers/tests/liveCommunities.test.ts +2 -2
- package/src/core/model/idResolvers.ts +1 -0
- package/src/core/model/identifyModel.ts +2 -1
- package/src/core/model/index.ts +11 -2
- package/src/follow/api/getFollowInfo.ts +4 -8
- package/src/follow/observers/index.ts +1 -0
- package/src/follow/observers/liveFollowInfo.ts +29 -0
- package/src/follow/observers/tests/liveFollowInfo.test.ts +198 -0
- package/src/message/api/createMessage.ts +17 -5
- package/src/message/api/tests/createMessage.test.ts +36 -5
- package/src/message/api/tests/deleteMessage.test.ts +10 -3
- package/src/message/api/tests/getMessage.test.ts +9 -3
- package/src/message/api/tests/queryMessages.test.ts +30 -0
- package/src/message/api/tests/updateMessage.test.ts +9 -2
- package/src/message/observers/liveMessages.ts +15 -15
- package/src/message/tests/observers/liveMessages.test.ts +2 -2
- package/src/message/utils/index.ts +10 -1
- package/src/post/api/queryPosts.ts +2 -1
- package/src/post/api/tests/queryPosts.test.ts +30 -0
- package/src/post/observers/livePosts.ts +16 -11
- package/src/post/observers/tests/livePosts.test.ts +4 -5
- package/src/reaction/api/tests/addReaction.test.ts +13 -0
- package/src/reaction/api/tests/removeReaction.test.ts +13 -0
- package/src/subChannel/api/querySubChannels.ts +2 -1
- package/src/subChannel/observers/liveSubChannels.ts +6 -5
- package/src/subChannel/observers/tests/liveSubChannels.test.ts +5 -2
- package/src/utils/constants.ts +2 -1
- package/src/utils/liveObject.ts +1 -4
- package/src/utils/tests/dummy/comment.ts +268 -0
- package/src/utils/tests/dummy/index.ts +1 -0
- package/src/utils/tests/dummy/post.ts +0 -114
- package/dist/post/tests/api/getPost.test.d.ts +0 -2
- package/dist/post/tests/api/getPost.test.d.ts.map +0 -1
- package/dist/post/tests/api/queryPosts.test.d.ts +0 -2
- package/dist/post/tests/api/queryPosts.test.d.ts.map +0 -1
- package/src/post/tests/api/getPost.test.ts +0 -98
- package/src/post/tests/api/queryPosts.test.ts +0 -123
|
@@ -29,36 +29,6 @@ export function generatePost(params?: Partial<Amity.Post>): Amity.Post {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function generateComment(params?: Partial<Amity.Comment>): Amity.Comment {
|
|
33
|
-
return {
|
|
34
|
-
path: '',
|
|
35
|
-
referenceType: 'post',
|
|
36
|
-
dataType: 'text',
|
|
37
|
-
dataTypes: ['text'],
|
|
38
|
-
rootId: 'test',
|
|
39
|
-
data: {
|
|
40
|
-
text: 'yellow new world',
|
|
41
|
-
},
|
|
42
|
-
childrenNumber: 0,
|
|
43
|
-
isDeleted: false,
|
|
44
|
-
editedAt: '2022-10-31T05:57:45.661Z',
|
|
45
|
-
updatedAt: '2022-10-31T05:57:45.670Z',
|
|
46
|
-
createdAt: '2022-10-31T05:57:45.661Z',
|
|
47
|
-
segmentNumber: 2,
|
|
48
|
-
commentId: 'comment11',
|
|
49
|
-
userId: 'test',
|
|
50
|
-
referenceId: 'postId11',
|
|
51
|
-
flagCount: 0,
|
|
52
|
-
hashFlag: null,
|
|
53
|
-
children: [],
|
|
54
|
-
mentionees: [],
|
|
55
|
-
reactions: {},
|
|
56
|
-
reactionsCount: 0,
|
|
57
|
-
attachments: [],
|
|
58
|
-
...params,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
32
|
export const post11: Amity.Post = generatePost();
|
|
63
33
|
|
|
64
34
|
export const post12: Amity.Post = {
|
|
@@ -96,43 +66,6 @@ export const post16: Amity.Post = {
|
|
|
96
66
|
targetType: 'user',
|
|
97
67
|
};
|
|
98
68
|
|
|
99
|
-
export const comment11: Amity.Comment = generateComment();
|
|
100
|
-
|
|
101
|
-
export const imageComment11: Amity.Comment = generateComment({
|
|
102
|
-
dataTypes: ['image'],
|
|
103
|
-
data: { text: '' },
|
|
104
|
-
attachments: [
|
|
105
|
-
{
|
|
106
|
-
type: 'image',
|
|
107
|
-
fileId: file11.fileId,
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
export const textImageComment11: Amity.Comment = generateComment({
|
|
113
|
-
dataTypes: ['image', 'text'],
|
|
114
|
-
data: { text: 'test' },
|
|
115
|
-
attachments: [
|
|
116
|
-
{
|
|
117
|
-
type: 'image',
|
|
118
|
-
fileId: file11.fileId,
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
export const textMentionComment11: Amity.Comment = generateComment({
|
|
124
|
-
mentionees: [
|
|
125
|
-
{
|
|
126
|
-
type: 'user',
|
|
127
|
-
userIds: [user11._id, user12._id],
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
export const textWithParentComment11: Amity.Comment = generateComment({
|
|
133
|
-
parentId: post12.postId,
|
|
134
|
-
});
|
|
135
|
-
|
|
136
69
|
export const posts = {
|
|
137
70
|
targetId: user11.userId,
|
|
138
71
|
targetType: 'user' as Amity.PostTargetType,
|
|
@@ -141,53 +74,6 @@ export const posts = {
|
|
|
141
74
|
page3: ['postId31', 'postId32', 'postId33'],
|
|
142
75
|
};
|
|
143
76
|
|
|
144
|
-
export const textCommentPayload: Amity.CommentPayload = {
|
|
145
|
-
comments: [comment11],
|
|
146
|
-
users: [user11],
|
|
147
|
-
commentChildren: [],
|
|
148
|
-
files: [],
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export const imageCommentPayload: Amity.CommentPayload = {
|
|
152
|
-
comments: [imageComment11],
|
|
153
|
-
users: [user11],
|
|
154
|
-
commentChildren: [],
|
|
155
|
-
files: [file11],
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
export const textImageCommentPayload: Amity.CommentPayload = {
|
|
159
|
-
comments: [textImageComment11],
|
|
160
|
-
users: [user11, user12],
|
|
161
|
-
commentChildren: [],
|
|
162
|
-
files: [file11],
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const textCommentMentionPayload: Amity.CommentPayload = {
|
|
166
|
-
comments: [textMentionComment11],
|
|
167
|
-
commentChildren: [],
|
|
168
|
-
users: [user11],
|
|
169
|
-
files: [],
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export const textCommentParentIdPayload: Amity.CommentPayload = {
|
|
173
|
-
comments: [textWithParentComment11],
|
|
174
|
-
commentChildren: [],
|
|
175
|
-
users: [user11],
|
|
176
|
-
files: [],
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export const postPayload: Amity.ProcessedPostPayload = {
|
|
180
|
-
posts: [post11],
|
|
181
|
-
users: [user11],
|
|
182
|
-
files: [file11],
|
|
183
|
-
comments: [comment11],
|
|
184
|
-
communityUsers: [],
|
|
185
|
-
categories: [],
|
|
186
|
-
communities: [],
|
|
187
|
-
feeds: [],
|
|
188
|
-
postChildren: [],
|
|
189
|
-
};
|
|
190
|
-
|
|
191
77
|
export const emptyPostPayload = {
|
|
192
78
|
posts: [],
|
|
193
79
|
postChildren: [],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPost.test.d.ts","sourceRoot":"","sources":["../../../../src/post/tests/api/getPost.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryPosts.test.d.ts","sourceRoot":"","sources":["../../../../src/post/tests/api/queryPosts.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { ASCApiError } from '~/core/errors';
|
|
2
|
-
import { client, emptyPostPayload, posts } from '~/utils/tests';
|
|
3
|
-
import { pushToCache, enableCache, disableCache } from '~/cache/api';
|
|
4
|
-
|
|
5
|
-
import { getPost } from '~/post/api';
|
|
6
|
-
|
|
7
|
-
describe('post/api', () => {
|
|
8
|
-
const post = { postId: posts.page1[0] };
|
|
9
|
-
const post2 = { postId: posts.page1[1] };
|
|
10
|
-
|
|
11
|
-
describe('getPost.locally', () => {
|
|
12
|
-
test('should return undefined if cache is turned off', () => {
|
|
13
|
-
expect(getPost.locally(post.postId)).toBeUndefined();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test('should return undefined if post not in cache', () => {
|
|
17
|
-
enableCache();
|
|
18
|
-
|
|
19
|
-
const cachedAt = Date.now();
|
|
20
|
-
|
|
21
|
-
pushToCache(['post', 'get', post.postId], post, { cachedAt });
|
|
22
|
-
|
|
23
|
-
expect(getPost.locally(post2.postId)).toBeUndefined();
|
|
24
|
-
|
|
25
|
-
disableCache();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('should return post if post in cache', () => {
|
|
29
|
-
enableCache();
|
|
30
|
-
|
|
31
|
-
const cachedAt = Date.now();
|
|
32
|
-
|
|
33
|
-
pushToCache(['post', 'get', post.postId], post, { cachedAt });
|
|
34
|
-
|
|
35
|
-
const data = getPost.locally(post.postId);
|
|
36
|
-
|
|
37
|
-
expect(data).toBeDefined();
|
|
38
|
-
expect(data?.data).toEqual(post);
|
|
39
|
-
expect(data?.cachedAt).toEqual(cachedAt);
|
|
40
|
-
|
|
41
|
-
disableCache();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('getPost', () => {
|
|
46
|
-
test('should return a post', async () => {
|
|
47
|
-
client.http.get = jest.fn().mockReturnValueOnce({
|
|
48
|
-
data: {
|
|
49
|
-
...emptyPostPayload,
|
|
50
|
-
posts: [post],
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const data = await getPost(post.postId);
|
|
55
|
-
|
|
56
|
-
expect(data).toBeDefined();
|
|
57
|
-
expect(data?.data).toEqual(post);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test('should put post into the cache after fetch', async () => {
|
|
61
|
-
enableCache();
|
|
62
|
-
client.http.get = jest.fn().mockReturnValueOnce({
|
|
63
|
-
data: {
|
|
64
|
-
...emptyPostPayload,
|
|
65
|
-
posts: [post],
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
await getPost(post.postId);
|
|
70
|
-
|
|
71
|
-
expect(getPost.locally(post.postId)?.data).toEqual(post);
|
|
72
|
-
|
|
73
|
-
disableCache();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test('should return an error', async () => {
|
|
77
|
-
client.http.get = jest.fn().mockRejectedValueOnce(new Error('error'));
|
|
78
|
-
|
|
79
|
-
await expect(getPost(post.postId)).rejects.toThrow('error');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test('should return an error if post in cache but api throws not found', async () => {
|
|
83
|
-
enableCache();
|
|
84
|
-
pushToCache(['post', 'get', post.postId], post, { cachedAt: Date.now() });
|
|
85
|
-
|
|
86
|
-
client.http.get = jest
|
|
87
|
-
.fn()
|
|
88
|
-
.mockRejectedValueOnce(
|
|
89
|
-
new ASCApiError('not found!', Amity.ServerError.ITEM_NOT_FOUND, Amity.ErrorLevel.ERROR),
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
await expect(getPost(post.postId)).rejects.toThrow();
|
|
93
|
-
|
|
94
|
-
expect(getPost.locally(post.postId)).toBeUndefined();
|
|
95
|
-
disableCache();
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
});
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { getResolver } from '~/core/model';
|
|
2
|
-
|
|
3
|
-
import { disableCache, enableCache, pushToCache } from '~/cache/api';
|
|
4
|
-
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
|
-
|
|
6
|
-
import { client, postQueryResponse } from '~/utils/tests';
|
|
7
|
-
|
|
8
|
-
import { queryPosts } from '../../api/queryPosts';
|
|
9
|
-
|
|
10
|
-
const params = { targetType: 'user', targetId: 'test' } as Amity.QueryPosts;
|
|
11
|
-
|
|
12
|
-
describe('queryPosts', () => {
|
|
13
|
-
test('it should return posts', async () => {
|
|
14
|
-
const { posts: expected } = postQueryResponse.data;
|
|
15
|
-
client.http.get = jest.fn().mockResolvedValue(postQueryResponse);
|
|
16
|
-
|
|
17
|
-
const { data } = await queryPosts(params);
|
|
18
|
-
|
|
19
|
-
expect(data).toEqual(expected);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test('it should throw error', async () => {
|
|
23
|
-
client.http.get = jest.fn().mockRejectedValueOnce(new Error('error'));
|
|
24
|
-
|
|
25
|
-
await expect(queryPosts(params)).rejects.toThrow('error');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test('it should update cache upon fetching data from server', async () => {
|
|
29
|
-
enableCache();
|
|
30
|
-
|
|
31
|
-
client.http.get = jest.fn().mockResolvedValue(postQueryResponse);
|
|
32
|
-
|
|
33
|
-
const { data: expected } = await queryPosts(params);
|
|
34
|
-
const { data: received } = queryPosts.locally(params)!;
|
|
35
|
-
|
|
36
|
-
expect(received).toBeDefined();
|
|
37
|
-
expect(received).toEqual(expected);
|
|
38
|
-
|
|
39
|
-
disableCache();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('queryPosts.locally', () => {
|
|
44
|
-
const cacheKey = ['post', 'query', { ...params, options: { limit: 10 } } as Amity.Serializable];
|
|
45
|
-
|
|
46
|
-
test('it should fetch query locally if present in cache', () => {
|
|
47
|
-
enableCache();
|
|
48
|
-
|
|
49
|
-
const { data } = postQueryResponse;
|
|
50
|
-
const { paging, ...payload } = data;
|
|
51
|
-
const { posts: expected } = payload;
|
|
52
|
-
|
|
53
|
-
ingestInCache(data as Amity.ProcessedPostPayload);
|
|
54
|
-
|
|
55
|
-
pushToCache(cacheKey, { posts: expected.map(getResolver('post')), paging });
|
|
56
|
-
|
|
57
|
-
const { data: received } = queryPosts.locally(params)!;
|
|
58
|
-
|
|
59
|
-
expect(received).toBeDefined();
|
|
60
|
-
expect(received).toEqual(expected);
|
|
61
|
-
|
|
62
|
-
disableCache();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('it should return undefined if only partial data in cache', () => {
|
|
66
|
-
enableCache();
|
|
67
|
-
|
|
68
|
-
const { data } = postQueryResponse;
|
|
69
|
-
const { posts, paging } = data;
|
|
70
|
-
|
|
71
|
-
// ingest incomplete data
|
|
72
|
-
ingestInCache({
|
|
73
|
-
...data,
|
|
74
|
-
posts: [data.posts[0]],
|
|
75
|
-
} as Amity.ProcessedPostPayload);
|
|
76
|
-
|
|
77
|
-
pushToCache(cacheKey, {
|
|
78
|
-
posts: posts.map(getResolver('post')),
|
|
79
|
-
paging,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const received = queryPosts.locally(params)!;
|
|
83
|
-
|
|
84
|
-
expect(received).toBeUndefined();
|
|
85
|
-
|
|
86
|
-
disableCache();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// added because of comment above cache key in queryPosts
|
|
90
|
-
test('it should return undefined if params do not match', () => {
|
|
91
|
-
enableCache();
|
|
92
|
-
|
|
93
|
-
const { data } = postQueryResponse;
|
|
94
|
-
const { posts: expected, paging } = data;
|
|
95
|
-
|
|
96
|
-
ingestInCache(data as Amity.ProcessedPostPayload);
|
|
97
|
-
|
|
98
|
-
pushToCache(cacheKey, { posts: expected.map(getResolver('post')), paging });
|
|
99
|
-
|
|
100
|
-
const { data: received } = queryPosts.locally(params)!;
|
|
101
|
-
const received2 = queryPosts.locally({ ...params, tags: ['tag1'] })!;
|
|
102
|
-
|
|
103
|
-
expect(received).toBeDefined();
|
|
104
|
-
expect(received).toEqual(expected);
|
|
105
|
-
expect(received2).toBeUndefined();
|
|
106
|
-
|
|
107
|
-
disableCache();
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
test('it should return undefined if data not in cache', () => {
|
|
111
|
-
enableCache();
|
|
112
|
-
|
|
113
|
-
const received = queryPosts.locally(params);
|
|
114
|
-
|
|
115
|
-
expect(received).toBeUndefined();
|
|
116
|
-
|
|
117
|
-
disableCache();
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test('it should return undefined if cache disabled', () => {
|
|
121
|
-
expect(queryPosts.locally(params)).toBeUndefined();
|
|
122
|
-
});
|
|
123
|
-
});
|