getOperatingSystemKnownDataDetails.spec.tsx 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import {operatingSystemKnownDataValues} from 'sentry/components/events/contexts/operatingSystem';
  2. import {getOperatingSystemKnownDataDetails} from 'sentry/components/events/contexts/operatingSystem/getOperatingSystemKnownDataDetails';
  3. import {operatingSystemMockData} from './index.spec';
  4. describe('getOperatingSystemKnownDataDetails', function () {
  5. it('returns values and according to the parameters', function () {
  6. const allKnownData: ReturnType<typeof getOperatingSystemKnownDataDetails>[] = [];
  7. for (const type of Object.keys(operatingSystemKnownDataValues)) {
  8. const operatingSystemKnownDataDetails = getOperatingSystemKnownDataDetails({
  9. type: operatingSystemKnownDataValues[type],
  10. data: operatingSystemMockData,
  11. });
  12. if (!operatingSystemKnownDataDetails) {
  13. continue;
  14. }
  15. allKnownData.push(operatingSystemKnownDataDetails);
  16. }
  17. expect(allKnownData).toEqual([
  18. {subject: 'Name', value: 'Mac OS X 10.14.0'},
  19. {subject: 'Version', value: ''},
  20. {subject: 'Kernel Version', value: ''},
  21. {subject: 'Rooted', value: null},
  22. ]);
  23. });
  24. });