Skip to content

Commit

Permalink
feat: lb3 migration tests for models customized with db metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakrkris committed Feb 21, 2020
1 parent ed949e4 commit 659f9f7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/cli/test/unit/import-lb3-model/migrate-model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,27 @@ describe('importLb3ModelDefinition', () => {
});
});

context('model attached to a datasource', () => {
let modelData;

before(function setupLb3AppWithDatasource() {
const MyModel = givenLb3Model('MyModel', {name: 'string'}, {}, {
connector: 'postgres'
});
modelData = importLb3ModelDefinition(MyModel, log);
});

it('normalizes custom property', () => {
expect(modelData.properties)
.to.have.property('name')
.deepEqual({
type: `'string'`,
tsType: 'string',
});
});

});

context('array properties', () => {
it('correctly converts short-hand definition', () => {
const MyModel = givenLb3Model('MyModel', {
Expand Down

0 comments on commit 659f9f7

Please sign in to comment.