mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16: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',
|
||||
prBody: 'foo',
|
||||
};
|
||||
// FIXME: explicit assert condition
|
||||
expect(configSerializer(config)).toMatchSnapshot();
|
||||
expect(configSerializer(config)).toMatchSnapshot({
|
||||
prBody: '[Template]',
|
||||
});
|
||||
});
|
||||
it('suppresses content', () => {
|
||||
const config = {
|
||||
content: {},
|
||||
};
|
||||
// FIXME: explicit assert condition
|
||||
expect(configSerializer(config)).toMatchSnapshot();
|
||||
expect(configSerializer(config)).toMatchSnapshot({
|
||||
content: '[content]',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -87,8 +87,15 @@ describe(getName(), () => {
|
|||
delete err.stack;
|
||||
|
||||
// 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.warn('a warning with a p4$$w0rd');
|
||||
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();
|
||||
expect(getProblems()).toHaveLength(0);
|
||||
});
|
||||
|
|
|
@ -67,8 +67,9 @@ describe(getName(), () => {
|
|||
d: ['e', 'f'],
|
||||
},
|
||||
};
|
||||
// FIXME: explicit assert condition
|
||||
expect(prettyStdout.getDetails(rec as any)).toMatchSnapshot();
|
||||
expect(prettyStdout.getDetails(rec as any)).toEqual(
|
||||
` "config": {"a": "b", "d": ["e", "f"]}\n`
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('formatRecord(rec)', () => {
|
||||
|
@ -88,8 +89,13 @@ describe(getName(), () => {
|
|||
d: ['e', 'f'],
|
||||
},
|
||||
};
|
||||
// FIXME: explicit assert condition
|
||||
expect(prettyStdout.formatRecord(rec)).toMatchSnapshot();
|
||||
expect(prettyStdout.formatRecord(rec)).toEqual(
|
||||
[
|
||||
`TRACE: test message`,
|
||||
` "config": {"a": "b", "d": ["e", "f"]}`,
|
||||
``,
|
||||
].join('\n')
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue