trade360-nodejs-sdk
Version:
LSports Trade360 SDK for Node.js
36 lines • 1.69 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const class_transformer_1 = require("class-transformer");
const statistic_value_1 = require("../../../../src/entities/core-entities/livescore/statistic-value");
describe('StatisticValue Entity', () => {
it('should deserialize a plain object into a StatisticValue instance', () => {
const plain = {
Id: 1,
Name: 'Goals',
Value: '2'
};
const statisticValue = (0, class_transformer_1.plainToInstance)(statistic_value_1.StatisticValue, plain, { excludeExtraneousValues: true });
expect(statisticValue).toBeInstanceOf(statistic_value_1.StatisticValue);
expect(statisticValue.id).toBe(1);
expect(statisticValue.name).toBe('Goals');
expect(statisticValue.value).toBe('2');
});
it('should handle missing properties', () => {
const plain = {};
const statisticValue = (0, class_transformer_1.plainToInstance)(statistic_value_1.StatisticValue, plain, { excludeExtraneousValues: true });
expect(statisticValue.id).toBeUndefined();
expect(statisticValue.name).toBeUndefined();
expect(statisticValue.value).toBeUndefined();
});
it('should ignore extraneous properties', () => {
const plain = {
Id: 2,
Name: 'Assists',
Value: '3',
Extra: 'ignore me'
};
const statisticValue = (0, class_transformer_1.plainToInstance)(statistic_value_1.StatisticValue, plain, { excludeExtraneousValues: true });
expect(statisticValue.Extra).toBeUndefined();
});
});
//# sourceMappingURL=statistic-value.spec.js.map