Skip to content

Commit

Permalink
Fix public attribute definition mapping reference
Browse files Browse the repository at this point in the history
  • Loading branch information
BigDataSamuli committed Nov 23, 2016
1 parent 50933e1 commit 3de2484
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/__tests__/mapping.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
defineString,
WrappedMappingData
} from '../';
import { AttributeDefinition } from '../mapping';

chai.use(chaiAsPromised);

Expand Down Expand Up @@ -38,7 +39,9 @@ describe("Simple typed SQL mapping", function () {

let mappingData = WrappedMappingData.getMappingData(mapping);
let fooAttributeDefinition = mappingData.getAttributeDefinition('foo');
let fooAttributeDefinition2: AttributeDefinition = mapping.foo as any;
expect(fooAttributeDefinition.mapping).to.equal(mapping);
expect(fooAttributeDefinition2.mapping).to.equal(mapping);
});

it("should error on property set attempt", async function () {
Expand Down
2 changes: 1 addition & 1 deletion src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function wrapMappingData<T>(mappingData: BaseMappingData<T>) {
for (let prop of mappingData.getAttributes()) {
Object.defineProperty(wrapper, prop, {
enumerable: true,
get: () => mappingData.getAttributeDefinition(prop)
get: () => wrapper.getAttributeDefinition(prop)
});
}

Expand Down

0 comments on commit 3de2484

Please sign in to comment.