This commit is contained in:
parent
e27279e20e
commit
449a06c85c
|
@ -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