salix/loopback/common/methods/vn-model/specs/getEnumValues.spec.js

20 lines
703 B
JavaScript
Raw Normal View History

const app = require('vn-loopback/server/server');
describe('Model getEnumValues()', () => {
it('should extend getEnumValues properties to any model passed', () => {
let exampleModel = app.models.TravelThermograph;
expect(exampleModel.getEnumValues).toBeDefined();
});
it('should return an array of enum values from a given column', async() => {
2021-10-20 11:32:03 +00:00
let result = await app.models.TpvTransaction.getSetValues('status');
2021-10-20 11:32:03 +00:00
expect(result.length).toEqual(4);
expect(result[0].value).toEqual('enum');
2021-10-20 11:32:03 +00:00
expect(result[1].value).toEqual('started');
expect(result[2].value).toEqual('ok');
expect(result[3].value).toEqual('ko');
});
});