mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
refactor(config): Reify snapshot tests (#11220)
This commit is contained in:
parent
3d1ea66f88
commit
08aa52ccc9
5 changed files with 31 additions and 24 deletions
|
@ -1,12 +0,0 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`logger/pretty-stdout formatRecord(rec) formats record 1`] = `
|
|
||||||
"TRACE: test message
|
|
||||||
\\"config\\": {\\"a\\": \\"b\\", \\"d\\": [\\"e\\", \\"f\\"]}
|
|
||||||
"
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`logger/pretty-stdout getDetails(rec) supports a config 1`] = `
|
|
||||||
" \\"config\\": {\\"a\\": \\"b\\", \\"d\\": [\\"e\\", \\"f\\"]}
|
|
||||||
"
|
|
||||||
`;
|
|
|
@ -7,14 +7,16 @@ describe(getName(), () => {
|
||||||
nottoken: 'b',
|
nottoken: 'b',
|
||||||
prBody: 'foo',
|
prBody: 'foo',
|
||||||
};
|
};
|
||||||
// FIXME: explicit assert condition
|
expect(configSerializer(config)).toMatchSnapshot({
|
||||||
expect(configSerializer(config)).toMatchSnapshot();
|
prBody: '[Template]',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('suppresses content', () => {
|
it('suppresses content', () => {
|
||||||
const config = {
|
const config = {
|
||||||
content: {},
|
content: {},
|
||||||
};
|
};
|
||||||
// FIXME: explicit assert condition
|
expect(configSerializer(config)).toMatchSnapshot({
|
||||||
expect(configSerializer(config)).toMatchSnapshot();
|
content: '[content]',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -87,8 +87,15 @@ describe(getName(), () => {
|
||||||
delete err.stack;
|
delete err.stack;
|
||||||
|
|
||||||
// sanitize like Bunyan
|
// sanitize like Bunyan
|
||||||
// FIXME: explicit assert condition
|
expect(sanitizeValue(err)).toMatchSnapshot({
|
||||||
expect(sanitizeValue(err)).toMatchSnapshot();
|
name: 'HTTPError',
|
||||||
|
options: {
|
||||||
|
method: 'POST',
|
||||||
|
password: '***********',
|
||||||
|
url: 'https://:**redacted**@github.com/api',
|
||||||
|
username: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -61,8 +61,12 @@ describe('logger', () => {
|
||||||
logger.error({ some: 'meta' }, 'message');
|
logger.error({ some: 'meta' }, 'message');
|
||||||
logger.warn('a warning with a p4$$w0rd');
|
logger.warn('a warning with a p4$$w0rd');
|
||||||
logger.info('ignored');
|
logger.info('ignored');
|
||||||
// FIXME: explicit assert condition
|
expect(getProblems()).toMatchSnapshot([
|
||||||
expect(getProblems()).toMatchSnapshot();
|
{ msg: 'some meta' },
|
||||||
|
{ some: 'meta', password: '***********' },
|
||||||
|
{ some: 'meta', msg: 'message' },
|
||||||
|
{ msg: 'a warning with a **redacted**' },
|
||||||
|
]);
|
||||||
clearProblems();
|
clearProblems();
|
||||||
expect(getProblems()).toHaveLength(0);
|
expect(getProblems()).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
|
@ -67,8 +67,9 @@ describe(getName(), () => {
|
||||||
d: ['e', 'f'],
|
d: ['e', 'f'],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// FIXME: explicit assert condition
|
expect(prettyStdout.getDetails(rec as any)).toEqual(
|
||||||
expect(prettyStdout.getDetails(rec as any)).toMatchSnapshot();
|
` "config": {"a": "b", "d": ["e", "f"]}\n`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('formatRecord(rec)', () => {
|
describe('formatRecord(rec)', () => {
|
||||||
|
@ -88,8 +89,13 @@ describe(getName(), () => {
|
||||||
d: ['e', 'f'],
|
d: ['e', 'f'],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
// FIXME: explicit assert condition
|
expect(prettyStdout.formatRecord(rec)).toEqual(
|
||||||
expect(prettyStdout.formatRecord(rec)).toMatchSnapshot();
|
[
|
||||||
|
`TRACE: test message`,
|
||||||
|
` "config": {"a": "b", "d": ["e", "f"]}`,
|
||||||
|
``,
|
||||||
|
].join('\n')
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue