fix(test-app): remove unnecessary eslint-disable comments
Clean up eslint-disable comments in test app TypeScript files: - Remove unnecessary comments from test-user-zero.ts - Remove unnecessary comments from router/index.ts - Keep only intentional console.log statements with proper eslint-disable comments
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:name=".TestApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* TestApplication.java
|
||||
*
|
||||
* Application class for the Daily Notification Plugin test app.
|
||||
* Registers the native content fetcher SPI implementation.
|
||||
*
|
||||
* @author Matthew Raymer
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
package com.timesafari.dailynotification.test;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
import com.timesafari.dailynotification.DailyNotificationPlugin;
|
||||
import com.timesafari.dailynotification.NativeNotificationContentFetcher;
|
||||
|
||||
/**
|
||||
* Application class that registers native fetcher for testing
|
||||
*/
|
||||
public class TestApplication extends Application {
|
||||
|
||||
private static final String TAG = "TestApplication";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
Log.i(TAG, "Initializing Daily Notification Plugin test app");
|
||||
|
||||
// Register test native fetcher
|
||||
NativeNotificationContentFetcher testFetcher =
|
||||
new com.timesafari.dailynotification.test.TestNativeFetcher();
|
||||
DailyNotificationPlugin.setNativeFetcher(testFetcher);
|
||||
|
||||
Log.i(TAG, "Test native fetcher registered: " + testFetcher.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* TestNativeFetcher.java
|
||||
*
|
||||
* Simple test implementation of NativeNotificationContentFetcher for the test app.
|
||||
* Returns mock notification content for testing purposes.
|
||||
*
|
||||
* @author Matthew Raymer
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
package com.timesafari.dailynotification.test;
|
||||
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.timesafari.dailynotification.FetchContext;
|
||||
import com.timesafari.dailynotification.NativeNotificationContentFetcher;
|
||||
import com.timesafari.dailynotification.NotificationContent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* Test implementation of native content fetcher
|
||||
*
|
||||
* Returns mock notification content for testing. In production, this would
|
||||
* fetch from TimeSafari API or other data sources.
|
||||
*/
|
||||
public class TestNativeFetcher implements NativeNotificationContentFetcher {
|
||||
|
||||
private static final String TAG = "TestNativeFetcher";
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public CompletableFuture<List<NotificationContent>> fetchContent(
|
||||
@NonNull FetchContext context) {
|
||||
|
||||
Log.d(TAG, "TestNativeFetcher: Fetch triggered - trigger=" + context.trigger +
|
||||
", scheduledTime=" + context.scheduledTime + ", fetchTime=" + context.fetchTime);
|
||||
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
// Simulate network delay
|
||||
Thread.sleep(100);
|
||||
|
||||
List<NotificationContent> contents = new ArrayList<>();
|
||||
|
||||
// Create a test notification
|
||||
NotificationContent testContent = new NotificationContent();
|
||||
testContent.setId("test_notification_" + System.currentTimeMillis());
|
||||
testContent.setTitle("Test Notification from Native Fetcher");
|
||||
testContent.setBody("This is a test notification from the native fetcher SPI. " +
|
||||
"Trigger: " + context.trigger +
|
||||
(context.scheduledTime != null ?
|
||||
", Scheduled: " + new java.util.Date(context.scheduledTime) : ""));
|
||||
|
||||
// Use scheduled time from context, or default to 1 hour from now
|
||||
long scheduledTimeMs = context.scheduledTime != null ?
|
||||
context.scheduledTime : (System.currentTimeMillis() + 3600000);
|
||||
testContent.setScheduledTime(scheduledTimeMs);
|
||||
|
||||
// fetchTime is set automatically by NotificationContent constructor (as fetchedAt)
|
||||
testContent.setPriority("default");
|
||||
testContent.setSound(true);
|
||||
|
||||
contents.add(testContent);
|
||||
|
||||
Log.i(TAG, "TestNativeFetcher: Returning " + contents.size() +
|
||||
" notification(s)");
|
||||
|
||||
return contents;
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(TAG, "TestNativeFetcher: Interrupted during fetch", e);
|
||||
Thread.currentThread().interrupt();
|
||||
return Collections.emptyList();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "TestNativeFetcher: Error during fetch", e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +260,7 @@ export class TestUserZeroAPI {
|
||||
*/
|
||||
setBaseUrl(url: string): void {
|
||||
this.baseUrl = url;
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🔧 API base URL updated to:", url);
|
||||
}
|
||||
|
||||
@@ -277,6 +278,7 @@ export class TestUserZeroAPI {
|
||||
|
||||
if (useMock) {
|
||||
// Return mock data for offline testing
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🧪 Using mock starred projects response");
|
||||
return MOCK_STARRED_PROJECTS_RESPONSE;
|
||||
}
|
||||
@@ -295,9 +297,9 @@ export class TestUserZeroAPI {
|
||||
afterId: afterId || TEST_USER_ZERO_CONFIG.starredProjects.lastAckedJwtId
|
||||
};
|
||||
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🌐 Making real API call to:", url);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("📦 Request body:", requestBody);
|
||||
|
||||
const response = await fetch(url, {
|
||||
@@ -318,8 +320,7 @@ export class TestUserZeroAPI {
|
||||
*/
|
||||
refreshToken(): void {
|
||||
this.jwt = generateTestJWT();
|
||||
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🔄 JWT token refreshed");
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ router.beforeEach((to, from, next) => {
|
||||
}
|
||||
|
||||
// Add loading state
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`🔄 Navigating from ${String(from.name) || 'unknown'} to ${String(to.name) || 'unknown'}`)
|
||||
|
||||
next()
|
||||
@@ -113,7 +113,7 @@ router.beforeEach((to, from, next) => {
|
||||
|
||||
router.afterEach((to) => {
|
||||
// Clear any previous errors on successful navigation
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`✅ Navigation completed: ${String(to.name) || 'unknown'}`)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user