-
Notifications
You must be signed in to change notification settings - Fork 420
/
Copy pathprofile-metainfo.test.js
94 lines (80 loc) · 2.54 KB
/
profile-metainfo.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// @flow
import {
formatProductAndVersion,
formatPlatform,
} from 'firefox-profiler/profile-logic/profile-metainfo';
import { getEmptyProfile } from '../../profile-logic/data-structures';
describe('profile-metainfo', () => {
function setup(metaOverride) {
const profile = getEmptyProfile();
Object.assign(profile.meta, metaOverride);
return profile;
}
describe('formatProductAndVersion', () => {
it('can format Firefox releases', () => {
const profile = setup({
product: 'Firefox',
misc: 'rv:61.0',
});
expect(formatProductAndVersion(profile.meta)).toBe('Firefox 61');
});
it('can format Firefox ESR releases', () => {
const profile = setup({
product: 'Firefox',
misc: 'rv:61.15',
});
expect(formatProductAndVersion(profile.meta)).toBe('Firefox 61.15');
});
it('can format Firefox chemspill versions', () => {
const profile = setup({
product: 'Firefox',
misc: 'rv:61.0.5',
});
expect(formatProductAndVersion(profile.meta)).toBe('Firefox 61.0.5');
});
it('can format Fenix versions', () => {
const profile = setup({
product: 'Firefox Preview',
misc: 'rv:77.0',
});
expect(formatProductAndVersion(profile.meta)).toBe('Firefox Preview 77');
});
});
describe('formatPlatform', () => {
it('can format MacOS information', () => {
const profile = setup({
oscpu: 'Intel Mac OS X 10.14',
platform: 'Macintosh',
toolkit: 'cocoa',
});
expect(formatPlatform(profile.meta)).toBe('macOS 10.14');
});
it('can format Windows information', () => {
const profile = setup({
oscpu: 'Windows NT 10.0; Win64; x64',
platform: 'Windows',
toolkit: 'windows',
});
expect(formatPlatform(profile.meta)).toBe('Windows 10');
});
it('can format Linux information', () => {
const profile = setup({
oscpu: 'Linux x86_64',
platform: 'X11',
toolkit: 'gtk',
});
expect(formatPlatform(profile.meta)).toBe('Linux');
});
it('can format Android information', () => {
const profile = setup({
oscpu: 'Linux armv7l',
platform: 'Android 7.0',
toolkit: 'android',
});
expect(formatPlatform(profile.meta)).toBe('Android 7');
});
});
});