2022-06-17 23:21:45 +00:00
|
|
|
import { danger, warn, message } from 'danger';
|
|
|
|
|
2022-07-22 01:14:42 +00:00
|
|
|
// Docs changes
|
2022-06-17 23:21:45 +00:00
|
|
|
const docs = danger.git.fileMatch('docs/**/*.md');
|
|
|
|
|
|
|
|
if (docs.edited) {
|
|
|
|
message('Thanks - We :heart: our [documentarians](http://www.writethedocs.org/)!');
|
|
|
|
}
|
|
|
|
|
2022-07-22 01:14:42 +00:00
|
|
|
// UI components
|
|
|
|
const uiCode = danger.git.fileMatch('app/soapbox/components/ui/**');
|
|
|
|
const uiTests = danger.git.fileMatch('app/soapbox/components/ui/**/__tests__/**');
|
|
|
|
|
2022-08-05 16:16:33 +00:00
|
|
|
if (uiCode.edited && !uiTests.edited) {
|
2022-07-22 01:14:42 +00:00
|
|
|
warn('You have UI changes (`soapbox/components/ui`) without tests.');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Actions
|
|
|
|
const actionsCode = danger.git.fileMatch('app/soapbox/actions/**');
|
|
|
|
const actionsTests = danger.git.fileMatch('app/soapbox/actions/**__tests__/**');
|
|
|
|
|
2022-08-05 16:16:33 +00:00
|
|
|
if (actionsCode.edited && !actionsTests.edited) {
|
2022-07-22 01:14:42 +00:00
|
|
|
warn('You have actions changes (`soapbox/actions`) without tests.');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reducers
|
|
|
|
const reducersCode = danger.git.fileMatch('app/soapbox/reducers/**');
|
|
|
|
const reducersTests = danger.git.fileMatch('app/soapbox/reducers/**__tests__/**');
|
|
|
|
|
2022-08-05 16:16:33 +00:00
|
|
|
if (reducersCode.edited && !reducersTests.edited) {
|
2022-07-22 01:14:42 +00:00
|
|
|
warn('You have reducer changes (`soapbox/reducers`) without tests.');
|
2022-06-17 23:21:45 +00:00
|
|
|
}
|