7199-devToTest_2316 #2287
|
@ -0,0 +1,35 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('Application getEnumValues()', () => {
|
||||
let tx;
|
||||
|
||||
beforeEach(async() => {
|
||||
tx = await models.Application.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
await models.Application.rawSql(`
|
||||
CREATE TABLE tableWithEnum (
|
||||
direction enum('in', 'out', 'middle'),
|
||||
PRIMARY KEY (direction)
|
||||
) ENGINE=InnoDB;
|
||||
`, null, options);
|
||||
});
|
||||
|
||||
it('should return three if is ok', async() => {
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const response = await models.Application.getEnumValues(
|
||||
'vn',
|
||||
'tableWithEnum',
|
||||
'direction',
|
||||
options
|
||||
);
|
||||
|
||||
expect(response.length).toEqual(3);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue