Files
Aislo/node_modules/@maplibre/maplibre-gl-style-spec/src/validate/validate_state.test.ts
T
2026-07-05 14:05:22 +09:00

16 lines
574 B
TypeScript

import {validateState} from './validate_state';
import {describe, test, expect} from 'vitest';
describe('Validate state', () => {
test('Should return no error if type is an object', () => {
const errors = validateState({key: 'state', value: {a: 1}});
expect(errors).toHaveLength(0);
});
test('Should return error if type is not an object', () => {
const errors = validateState({key: 'state', value: 3});
expect(errors).toHaveLength(1);
expect(errors[0].message).toBe('state: object expected, number found');
});
});