Files
undergroundwires a721e82a4f Bump TypeScript to 5.3 with verbatimModuleSyntax
This commit upgrades TypeScript to the latest version 5.3 and introduces
`verbatimModuleSyntax` in line with the official Vue guide
recommendatinos (vuejs/docs#2592).

By enforcing `import type` for type-only imports, this commit improves
code clarity and supports tooling optimization, ensuring imports are
only bundled when necessary for runtime.

Changes:

- Bump TypeScript to 5.3.3 across the project.
- Adjust import statements to utilize `import type` where applicable,
  promoting cleaner and more efficient code.
2024-02-27 04:20:22 +01:00

31 lines
1.3 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { OperatingSystem } from '@/domain/OperatingSystem';
import { ConditionBasedOsDetector } from '@/infrastructure/RuntimeEnvironment/Browser/BrowserOs/ConditionBasedOsDetector';
import type { BrowserEnvironment } from '@/infrastructure/RuntimeEnvironment/Browser/BrowserOs/BrowserOsDetector';
import { formatAssertionMessage } from '@tests/shared/FormatAssertionMessage';
import { BrowserOsTestCases } from './BrowserOsTestCases';
describe('ConditionBasedOsDetector', () => {
describe('detect', () => {
it('detects as expected', () => {
BrowserOsTestCases.forEach((testCase) => {
// arrange
const sut = new ConditionBasedOsDetector();
const environment: BrowserEnvironment = {
userAgent: testCase.userAgent,
isTouchSupported: testCase.platformTouchSupport,
};
// act
const actual = sut.detect(environment);
// assert
expect(actual).to.equal(testCase.expectedOs, formatAssertionMessage([
`Expected: "${OperatingSystem[testCase.expectedOs]}"`,
`Actual: "${actual === undefined ? 'undefined' : OperatingSystem[actual]}"`,
`User agent: "${testCase.userAgent}"`,
`Touch support: "${testCase.platformTouchSupport ? 'Yes, supported' : 'No, unsupported.'}"`,
]));
});
});
});
});