[Timeline] Test inclusion of metadata headers
This commit is contained in:
@@ -26,6 +26,7 @@ define(
|
|||||||
function (TimelineCSVExporter) {
|
function (TimelineCSVExporter) {
|
||||||
describe("TimelineCSVExporter", function () {
|
describe("TimelineCSVExporter", function () {
|
||||||
var mockDomainObjects,
|
var mockDomainObjects,
|
||||||
|
testMetadata,
|
||||||
exporter;
|
exporter;
|
||||||
|
|
||||||
function makeMockDomainObject(model, index) {
|
function makeMockDomainObject(model, index) {
|
||||||
@@ -41,16 +42,28 @@ define(
|
|||||||
);
|
);
|
||||||
mockDomainObject.getId.andReturn('id-' + index);
|
mockDomainObject.getId.andReturn('id-' + index);
|
||||||
mockDomainObject.getModel.andReturn(model);
|
mockDomainObject.getModel.andReturn(model);
|
||||||
|
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||||
|
return c === 'metadata' && [];
|
||||||
|
});
|
||||||
return mockDomainObject;
|
return mockDomainObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
testMetadata = [
|
||||||
|
{ name: "abc", value: 123 },
|
||||||
|
{ name: "xyz", value: 456 }
|
||||||
|
];
|
||||||
|
|
||||||
mockDomainObjects = [
|
mockDomainObjects = [
|
||||||
{ composition: [ 'a', 'b', 'c' ] },
|
{ composition: [ 'a', 'b', 'c' ] },
|
||||||
{ relationships: { modes: [ 'x', 'y' ] } },
|
{ relationships: { modes: [ 'x', 'y' ] } },
|
||||||
{ }
|
{ }
|
||||||
].map(makeMockDomainObject);
|
].map(makeMockDomainObject);
|
||||||
|
|
||||||
|
mockDomainObjects[2].useCapability.andCallFake(function (c) {
|
||||||
|
return c === 'metadata' && testMetadata;
|
||||||
|
});
|
||||||
|
|
||||||
exporter = new TimelineCSVExporter(mockDomainObjects);
|
exporter = new TimelineCSVExporter(mockDomainObjects);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -79,7 +92,20 @@ define(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("headers", function () {
|
||||||
|
var headers;
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
headers = exporter.headers();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("contains all metadata properties", function () {
|
||||||
|
testMetadata.forEach(function (property) {
|
||||||
|
expect(headers.indexOf(property.name))
|
||||||
|
.not.toEqual(-1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user