Skip to content

Commit

Permalink
Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
kalenkevich committed Oct 14, 2023
1 parent fc18bbe commit 760bf52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/map/styles/styles_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export function getPropertyValue<V>(source: any, property?: string | number): Co
}

if (!['number', 'string'].includes(typeof property)) {
throw new Error('Cannot get property name from: ' + JSON.stringify(property));
throw new Error('Cannot get value from: ' + JSON.stringify(property));
}

let currentSource = source;
Expand Down
8 changes: 5 additions & 3 deletions tests/unit/map/styles/styles_utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
} from '../../../../src/map/styles/styles';
import {
compileStatement,
compileIfStatement,
compileIfStatementFork,
compileSwitchCaseStatement,
compileConditionStatement,
compileConditionStatementOrValue,
Expand Down Expand Up @@ -811,14 +813,14 @@ describe('getPropertyValue', () => {
expect(() => {
//@ts-ignore
getPropertyValue<string>(object, true);
}).toThrowError('Cannot get property name from: true');
}).toThrowError('Cannot get value from: true');
expect(() => {
//@ts-ignore
getPropertyValue<string>(object, {});
}).toThrowError('Cannot get property name from: {}');
}).toThrowError('Cannot get value from: {}');
expect(() => {
//@ts-ignore
getPropertyValue<string>(object, []);
}).toThrowError('Cannot get property name from: []');
}).toThrowError('Cannot get value from: []');
});
});

0 comments on commit 760bf52

Please sign in to comment.