Skip to content

Commit ecfb90c

Browse files
Add tests for the platform helper
1 parent dccd7ee commit ecfb90c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import os from 'os'
2+
import {platform} from '../src/core'
3+
4+
describe('getInfo', () => {
5+
it('returns the platform info', async () => {
6+
const info = await platform.getDetails()
7+
expect(info).toEqual({
8+
name: expect.any(String),
9+
platform: expect.any(String),
10+
arch: expect.any(String),
11+
version: expect.any(String),
12+
isWindows: expect.any(Boolean),
13+
isMacOS: expect.any(Boolean),
14+
isLinux: expect.any(Boolean)
15+
})
16+
})
17+
18+
it('returns the platform info with the correct name', async () => {
19+
const isWindows = os.platform() === 'win32'
20+
const isMacOS = os.platform() === 'darwin'
21+
const isLinux = os.platform() === 'linux'
22+
23+
const info = await platform.getDetails()
24+
expect(info.platform).toEqual(os.platform())
25+
expect(info.isWindows).toEqual(isWindows)
26+
expect(info.isMacOS).toEqual(isMacOS)
27+
expect(info.isLinux).toEqual(isLinux)
28+
})
29+
})

0 commit comments

Comments
 (0)