Skip to content

Commit 86a8998

Browse files
committed
Add test
1 parent 35b2ff4 commit 86a8998

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

packages/core/test/expo-plugin/withSentryAndroidGradlePlugin.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,22 @@ describe('withSentryAndroidGradlePlugin', () => {
7575
const includedBuildGradle = `dependencies { classpath("io.sentry:sentry-android-gradle-plugin:${sentryAndroidGradlePluginVersion}")}`;
7676
const options: SentryAndroidGradlePluginOptions = { enableAndroidGradlePlugin: true };
7777

78+
const projectBuildGradle = {
79+
modResults: { language: 'groovy', contents: includedBuildGradle },
80+
};
81+
7882
(withProjectBuildGradle as jest.Mock).mockImplementation((config, callback) => {
79-
callback({ modResults: { language: 'groovy', contents: includedBuildGradle } });
83+
callback(projectBuildGradle);
8084
});
8185

8286
withSentryAndroidGradlePlugin(mockConfig, options);
8387

88+
const calledCallback = (withProjectBuildGradle as jest.Mock).mock.calls[0][1];
89+
const modifiedGradle = calledCallback(projectBuildGradle);
90+
91+
expect(modifiedGradle).toEqual({
92+
modResults: { language: 'groovy', contents: includedBuildGradle },
93+
});
8494
expect(warnOnce).toHaveBeenCalledWith(
8595
'sentry-android-gradle-plugin dependency in already in android/build.gradle.',
8696
);

0 commit comments

Comments
 (0)