2022-03-16 18:54:41 -07:00
|
|
|
|
2023-06-20 12:24:39 -07:00
|
|
|
import { buildStatus } from 'soapbox/jest/factory';
|
2022-03-16 18:54:41 -07:00
|
|
|
|
2022-06-08 09:06:14 -07:00
|
|
|
import {
|
|
|
|
hasIntegerMediaIds,
|
|
|
|
defaultMediaVisibility,
|
|
|
|
} from '../status';
|
2022-03-16 18:54:41 -07:00
|
|
|
|
|
|
|
describe('hasIntegerMediaIds()', () => {
|
|
|
|
it('returns true for a Pleroma deleted status', () => {
|
2023-06-20 12:24:39 -07:00
|
|
|
const status = buildStatus(require('soapbox/__fixtures__/pleroma-status-deleted.json'));
|
2022-03-16 18:54:41 -07:00
|
|
|
expect(hasIntegerMediaIds(status)).toBe(true);
|
|
|
|
});
|
|
|
|
});
|
2022-06-08 09:06:14 -07:00
|
|
|
|
|
|
|
describe('defaultMediaVisibility()', () => {
|
|
|
|
it('returns false with no status', () => {
|
|
|
|
expect(defaultMediaVisibility(undefined, 'default')).toBe(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('hides sensitive media by default', () => {
|
2023-06-20 12:24:39 -07:00
|
|
|
const status = buildStatus({ sensitive: true });
|
2022-06-08 09:06:14 -07:00
|
|
|
expect(defaultMediaVisibility(status, 'default')).toBe(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('hides media when displayMedia is hide_all', () => {
|
2023-06-20 12:24:39 -07:00
|
|
|
const status = buildStatus({});
|
2022-06-08 09:06:14 -07:00
|
|
|
expect(defaultMediaVisibility(status, 'hide_all')).toBe(false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('shows sensitive media when displayMedia is show_all', () => {
|
2023-06-20 12:24:39 -07:00
|
|
|
const status = buildStatus({ sensitive: true });
|
2022-06-08 09:06:14 -07:00
|
|
|
expect(defaultMediaVisibility(status, 'show_all')).toBe(true);
|
|
|
|
});
|
|
|
|
});
|