This repository has been archived on 2026-07-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
espocrm-base/frontend/test/spec/test.metadata.js
T
Yuri Kuznetsov 99195313c5 add frontend
2014-04-11 11:44:02 +03:00

41 lines
895 B
JavaScript

var Espo = Espo || {};
describe("Metadata", function () {
var metadata;
Espo.Metadata.prototype.key = 'test';
beforeEach(function () {
Espo.Metadata.prototype.load = function () {};
metadata = new Espo.Metadata();
metadata.data = {
recordDefs: {
Lead: {
some: {type: 'varchar'},
}
},
};
});
it('#updateData should work correctly', function () {
metadata.updateData('recordDefs/Lead', {
some: {type: 'text'}
});
expect(metadata.data.recordDefs.Lead.some.type).toBe('text');
metadata.updateData('recordDefs/Contact', {
some: {type: 'text'}
});
expect(metadata.data.recordDefs.Contact.some.type).toBe('text');
});
it('#get should work correctly', function () {
expect(metadata.get('recordDefs/Lead/some')).toBe(metadata.data.recordDefs.Lead.some);
expect(metadata.get('recordDefs/Contact')).toBe(null);
});
});