logs: simplify releases

This commit is contained in:
Rhys Arkins 2018-06-27 07:21:17 +02:00
parent 74d567897c
commit d8b50d7b09
3 changed files with 31 additions and 0 deletions

View file

@ -33,6 +33,9 @@ function configSerializer(config) {
if (val && contentFields.includes(this.key)) { if (val && contentFields.includes(this.key)) {
this.update('[content]'); this.update('[content]');
} }
if (val && this.key === 'releases') {
this.update(val.map(release => release.version));
}
// istanbul ignore if // istanbul ignore if
if (val && arrayFields.includes(this.key)) { if (val && arrayFields.includes(this.key)) {
this.update('[Array]'); this.update('[Array]');

View file

@ -8,6 +8,15 @@ Object {
} }
`; `;
exports[`logger/config-serializer simplifies releases 1`] = `
Object {
"releases": Array [
"1.0.0-rc.2",
"1.0.0-rc.3",
],
}
`;
exports[`logger/config-serializer squashes templates 1`] = ` exports[`logger/config-serializer squashes templates 1`] = `
Object { Object {
"nottoken": "b", "nottoken": "b",

View file

@ -22,4 +22,23 @@ describe('logger/config-serializer', () => {
}; };
expect(configSerializer(config)).toMatchSnapshot(); expect(configSerializer(config)).toMatchSnapshot();
}); });
it('simplifies releases', () => {
const config = {
releases: [
{
version: '1.0.0-rc.2',
gitRef: 'f6fd3d463e4a1c70dd7c2b2e4ea8637ccb05f2c7',
time: '2018-06-18T21:18:58.840Z',
canBeUnpublished: false,
},
{
version: '1.0.0-rc.3',
gitRef: 'da10c705e55c03dbbeeefa7f30e86225b10a7b82',
time: '2018-06-26T19:12:38.659Z',
canBeUnpublished: true,
},
],
};
expect(configSerializer(config)).toMatchSnapshot();
});
}); });