@oxyhq/bloom 0.30.6 → 0.30.7
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
|
@@ -30,14 +30,29 @@ describe('Avatar variant resolution', () => {
|
|
|
30
30
|
expect(resolver).toHaveBeenCalledWith('file_123', 'thumb');
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
it(
|
|
33
|
+
it("defaults the variant to 'thumb' when none is supplied for a bare file ID", () => {
|
|
34
34
|
const resolver = jest.fn<ReturnType<ImageResolver>, Parameters<ImageResolver>>(
|
|
35
35
|
(id) => `https://cloud.oxy.so/${id}`,
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
renderWithProviders(<Avatar source="file_456" size={40} />, resolver);
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
// No explicit variant → the safe default 'thumb', never the full-size
|
|
41
|
+
// original (undefined would request full size per the ImageResolver contract).
|
|
42
|
+
expect(resolver).toHaveBeenCalledWith('file_456', 'thumb');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('forwards an explicit variant unchanged, overriding the default', () => {
|
|
46
|
+
const resolver = jest.fn<ReturnType<ImageResolver>, Parameters<ImageResolver>>(
|
|
47
|
+
(id, variant) => `https://cloud.oxy.so/${id}?variant=${variant ?? ''}`,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
renderWithProviders(
|
|
51
|
+
<Avatar source="file_999" variant="w320" size={96} />,
|
|
52
|
+
resolver,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
expect(resolver).toHaveBeenCalledWith('file_999', 'w320');
|
|
41
56
|
});
|
|
42
57
|
|
|
43
58
|
it('does NOT invoke the resolver when source is already a full URL', () => {
|