1 parent
7657bdf22c
commit
2678500670
14 files changed
+232
-11
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { isCompanionApp } from '../../src/utils/companion';
|
||||
|
||||
describe('isCompanionApp', () => {
|
||||
it('should return true for userAgent starting with "Home Assistant/"', () => {
|
||||
expect(isCompanionApp('Home Assistant/1.0')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true for userAgent starting with "HomeAssistant/"', () => {
|
||||
expect(isCompanionApp('HomeAssistant/1.0')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for userAgent not starting with "Home Assistant/" or "HomeAssistant/"', () => {
|
||||
expect(isCompanionApp('Mozilla/5.0')).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for an empty userAgent', () => {
|
||||
expect(isCompanionApp('')).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user