@@ -4,6 +4,7 @@ import {
|
||||
conditionalSchema,
|
||||
customSchema,
|
||||
dimensionsConfigSchema,
|
||||
frigateCardConditionSchema,
|
||||
frigateCardCustomActionsBaseSchema,
|
||||
frigateCardCustomActionSchema,
|
||||
} from '../../src/config/types';
|
||||
@@ -401,6 +402,29 @@ it('should transform dimensions.aspect_ratio', () => {
|
||||
).toEqual(expect.objectContaining({ aspect_ratio: [16, 9] }));
|
||||
});
|
||||
|
||||
describe('should refine user_agent_re conditions', () => {
|
||||
it('should successfully parse valid user_agent_re condition', () => {
|
||||
expect(
|
||||
frigateCardConditionSchema.parse({
|
||||
condition: 'user_agent',
|
||||
user_agent_re: 'Chrome/',
|
||||
}),
|
||||
).toEqual({
|
||||
condition: 'user_agent',
|
||||
user_agent_re: 'Chrome/',
|
||||
});
|
||||
});
|
||||
|
||||
it('should reject invalid user_agent_re conditions', () => {
|
||||
expect(() =>
|
||||
frigateCardConditionSchema.parse({
|
||||
condition: 'user_agent',
|
||||
user_agent_re: '[',
|
||||
}),
|
||||
).toThrowError(/Invalid regular expression/);
|
||||
});
|
||||
});
|
||||
|
||||
it('should transform action', () => {
|
||||
expect(
|
||||
frigateCardCustomActionsBaseSchema.parse({
|
||||
|
||||
Reference in New Issue
Block a user