-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ #99 add unit test for common telemetry
Signed-off-by: JAGFx <[email protected]>
- Loading branch information
Showing
2 changed files
with
38 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Unit tests" type="JavaScriptTestRunnerJest"> | ||
<node-interpreter value="project" /> | ||
<node-options value="" /> | ||
<jest-package value="$PROJECT_DIR$/node_modules/jest" /> | ||
<working-dir value="$PROJECT_DIR$" /> | ||
<envs /> | ||
<scope-kind value="ALL" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
import { $scale } from '@/utils/telemetry/_common.utils'; | ||
|
||
describe('Telemetry common utils', () => { | ||
const windowWidth = 1920; | ||
const windowHeight = 1080; | ||
|
||
global.innerWidth = windowWidth; | ||
global.innerHeight = windowHeight + 41; | ||
|
||
test.each([ | ||
{ | ||
size: { | ||
width: 0, | ||
height: 720 | ||
} | ||
}, | ||
{ | ||
size: { | ||
width: 1280, | ||
height: 0 | ||
} | ||
}, | ||
{ | ||
size: { | ||
width: 0, | ||
height: 0 | ||
} | ||
} | ||
])( | ||
'Test $scale must return 1 without skin width or height', | ||
(currentSkin) => { | ||
global.innerWidth = 1920; | ||
global.innerHeight = 1080; | ||
{ size: { width: 2560, height: windowHeight } }, | ||
{ size: { width: 0, height: windowHeight } }, | ||
{ size: { width: 4096, height: 2048 } }, | ||
{ size: { width: windowWidth, height: 2048 } }, | ||
{ size: { width: windowWidth, height: 0 } }, | ||
{ size: { width: windowWidth, height: windowHeight } }, | ||
{ size: { width: 0, height: 0 } } | ||
])('The skin should be reduced', (currentSkin) => { | ||
expect($scale(currentSkin)).toBeLessThan(1); | ||
}); | ||
|
||
expect($scale(currentSkin)).toBe(1); | ||
} | ||
); | ||
test.each([ | ||
{ size: { width: 1280, height: windowHeight } }, | ||
{ size: { width: 0, height: windowHeight } }, | ||
{ size: { width: 1280, height: 720 } }, | ||
{ size: { width: windowWidth, height: 720 } }, | ||
{ size: { width: windowWidth, height: 0 } }, | ||
{ size: { width: windowWidth, height: windowHeight } }, | ||
{ size: { width: 0, height: 0 } } | ||
])('The skin should be enlarged', (currentSkin) => { | ||
expect($scale(currentSkin)).toBeGreaterThanOrEqual(1); | ||
}); | ||
}); |