stream-chat-expo 9.8.3-beta.2 → 9.9.0
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-expo",
|
|
3
3
|
"description": "The official Expo SDK for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.9.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"types": "types/index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"mime": "^4.0.7",
|
|
30
|
-
"stream-chat-react-native-core": "9.
|
|
30
|
+
"stream-chat-react-native-core": "9.9.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"expo": ">=52.0.0",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
describe('expo compressImage', () => {
|
|
2
|
+
const manipulateAsync = jest.fn();
|
|
3
|
+
|
|
4
|
+
const loadHandler = () => {
|
|
5
|
+
jest.doMock('expo-image-manipulator', () => ({ manipulateAsync }), { virtual: true });
|
|
6
|
+
|
|
7
|
+
return require('../compressImage').compressImage as (params: {
|
|
8
|
+
compressImageQuality: number;
|
|
9
|
+
uri: string;
|
|
10
|
+
}) => Promise<string>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
manipulateAsync.mockResolvedValue({ uri: 'file:///cache/out.jpg' });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
jest.resetModules();
|
|
19
|
+
jest.clearAllMocks();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('ignores a background colour rather than forwarding one', async () => {
|
|
23
|
+
// Deliberate asymmetry: backgroundColor is CLI-only. expo-image-manipulator can only fill a
|
|
24
|
+
// background while *extending* an image and marks that option @platform web, so there is no
|
|
25
|
+
// way to honour it here.
|
|
26
|
+
//
|
|
27
|
+
// The *type-level* guarantee (passing one is a compile error) is enforced by tsc over `src`,
|
|
28
|
+
// not by this file - expo-package/tsconfig.json excludes `**/__tests__`, so a
|
|
29
|
+
// `@ts-expect-error` here would never be verified and would only look like a guarantee.
|
|
30
|
+
// What this test pins is the runtime half: nothing reaches ImageManipulator.
|
|
31
|
+
const compressImage = loadHandler();
|
|
32
|
+
|
|
33
|
+
await compressImage({
|
|
34
|
+
compressImageQuality: 0.5,
|
|
35
|
+
uri: 'file:///in.png',
|
|
36
|
+
...({ backgroundColor: '#FFFFFF' } as Record<string, never>),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
expect(manipulateAsync).toHaveBeenCalledWith('file:///in.png', [], { compress: 0.5 });
|
|
40
|
+
const [, , options] = manipulateAsync.mock.calls[0];
|
|
41
|
+
expect(options).not.toHaveProperty('backgroundColor');
|
|
42
|
+
expect(Object.keys(options)).toEqual(['compress']);
|
|
43
|
+
});
|
|
44
|
+
});
|