Skip to content

Commit ce1bf3c

Browse files
authored
Refactor component and lib source paths (#12)
Move component and lib source implementations out of the app router directory and into the `src/component` and `src/lib directories`.
1 parent f333c60 commit ce1bf3c

File tree

53 files changed

+67
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+67
-71
lines changed

app/tests/analytics/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import ClientResults from '../components/csr_test_runner';
18+
import ClientResults from '@/components/app_tests/analytics/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'Analytics Web SDK CSR test'

app/tests/analytics/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testAnalytics, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testAnalytics, TestResults } from '@/lib/app_tests/analytics/test';
19+
import ResultsDisplay from '@/components/app_tests/analytics/results_display';
2020

2121
export const metadata: Metadata = {
2222
title: 'Analytics Web SDK SSR test'

app/tests/app/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import CsrTestRunner from '../components/csr_test_runner';
18+
import CsrTestRunner from '@/components/app_tests/app/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'App Web SDK CSR test'

app/tests/app/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testApp, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testApp, TestResults } from '@/lib/app_tests/app/test';
19+
import ResultsDisplay from '@/components/app_tests/app/results_display';
2020

2121
// Suppress static site generation.
2222
export const dynamic = "force-dynamic";

app/tests/app_check/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import ClientResults from '../components/csr_test_runner';
18+
import ClientResults from '@/components/app_tests/app_check/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'AppCheck Web SDK CSR test'

app/tests/app_check/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testAppCheck, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testAppCheck, TestResults } from '@/lib/app_tests/app_check/test';
19+
import ResultsDisplay from '@/components/app_tests/app_check/results_display';
2020

2121
// Suppress static site generation.
2222
export const dynamic = "force-dynamic";

app/tests/auth/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import CSRTestRunner from '../components/csr_test_runner';
18+
import CSRTestRunner from '@/components/app_tests/auth/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'Auth Web SDK CSR test'

app/tests/auth/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testAuth, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testAuth, TestResults } from '@/lib/app_tests/auth/test';
19+
import ResultsDisplay from '@/components/app_tests/auth/results_display';
2020

2121
// Suppress static site generation.
2222
export const dynamic = "force-dynamic";

app/tests/database/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import CSRTestRunner from '../components/csr_test_runner';
18+
import CSRTestRunner from '@/components/app_tests/database/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'Database Web SDK CSR test'

app/tests/database/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testDatabase, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testDatabase, TestResults } from '@/lib/app_tests/database/test';
19+
import ResultsDisplay from '@/components/app_tests/database/results_display';
2020

2121
// Suppress static site generation.
2222
export const dynamic = "force-dynamic";

app/tests/firestore/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import CSRTestRunner from '../components/csr_test_runner';
18+
import CSRTestRunner from '@/components/app_tests/firestore/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'Firestore Web SDK CSR test'

app/tests/firestore/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testFirestore, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testFirestore, TestResults } from '@/lib/app_tests/firestore/test';
19+
import ResultsDisplay from '@/components/app_tests/firestore/results_display';
2020

2121
// Suppress static site generation as this hangs on the app deletion in test.ts.
2222
export const dynamic = "force-dynamic";

app/tests/functions/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import CSRTestRunner from '../components/csr_test_runner';
18+
import CSRTestRunner from '@/components/app_tests/functions/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'Functions Web SDK CSR test'

app/tests/functions/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testFunctions, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testFunctions, TestResults } from '@/lib/app_tests/functions/test';
19+
import ResultsDisplay from '@/components/app_tests/functions/results_display';
2020

2121
// Suppress static site generation.
2222
export const dynamic = "force-dynamic";

app/tests/messaging/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import CSRTestRunner from '../components/csr_test_runner';
18+
import CSRTestRunner from '@/components/app_tests/messaging/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'Messaging Web SDK CSR test'

app/tests/messaging/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testMessaging, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testMessaging, TestResults } from '@/lib/app_tests/messaging/test';
19+
import ResultsDisplay from '@/components/app_tests/messaging/results_display';
2020

2121
// Suppress static site generation.
2222
export const dynamic = "force-dynamic";

app/tests/performance/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import CSRTestRunner from '../components/csr_test_runner';
18+
import CSRTestRunner from '@/components/app_tests/performance/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'Performance Web SDK CSR test'

app/tests/performance/web_ssr/page.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testPerformance, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testPerformance, TestResults } from '@/lib/app_tests/performance/test';
19+
import ResultsDisplay from '@/components/app_tests/performance/results_display';
2020

2121
// Suppress static site generation.
2222
export const dynamic = "force-dynamic";

app/tests/storage/web_client/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import CSRTestRunner from '../components/csr_test_runner';
18+
import CSRTestRunner from '@/components/app_tests/storage/csr_test_runner';
1919

2020
export const metadata: Metadata = {
2121
title: 'Storage Web SDK CSR test'

app/tests/storage/web_ssr/page.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import type { Metadata } from 'next'
18-
import { testStorage, TestResults } from '../lib/test';
19-
import ResultsDisplay from '../components/results_display';
18+
import { testStorage, TestResults } from '@/lib/app_tests/storage/test';
19+
import ResultsDisplay from '@/components/app_tests/storage/results_display';
2020

2121
// Suppress static site generation.
2222
export const dynamic = "force-dynamic";
@@ -26,7 +26,7 @@ export const metadata: Metadata = {
2626
}
2727

2828
export default async function Page() {
29-
const testResults: TestResults = await testStorage(/*isServer=*/true);
29+
const testResults: TestResults = await testStorage();
3030
return (
3131
<>
3232
<h1>Storage SSR Test results:</h1>

app/tests/analytics/components/csr_test_runner.tsx src/components/app_tests/analytics/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testAnalytics, initializeTestResults } from '../lib/test';
20+
import { testAnalytics, initializeTestResults } from '@/lib/app_tests/analytics/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function ClientResults() {

app/tests/app/components/csr_test_runner.tsx src/components/app_tests/app/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testApp, initializeTestResults } from '../lib/test';
20+
import { testApp, initializeTestResults } from '@/lib/app_tests/app/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function CsrTestRunner() {

app/tests/app_check/components/csr_test_runner.tsx src/components/app_tests/app_check/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testAppCheck, initializeTestResults } from '../lib/test';
20+
import { testAppCheck, initializeTestResults } from '@/lib/app_tests/app_check/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function ClientResults() {

app/tests/auth/components/csr_test_runner.tsx src/components/app_tests/auth/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testAuth, initializeTestResults } from '../lib/test';
20+
import { testAuth, initializeTestResults } from '@/lib/app_tests/auth/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function CsrTestRunner() {

app/tests/database/components/csr_test_runner.tsx src/components/app_tests/database/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testDatabase, initializeTestResults } from '../lib/test';
20+
import { testDatabase, initializeTestResults } from '@/lib/app_tests/database/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function CsrTestRunner() {

app/tests/firestore/components/csr_test_runner.tsx src/components/app_tests/firestore/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testFirestore, initializeTestResults } from '../lib/test';
20+
import { testFirestore, initializeTestResults } from '@/lib/app_tests/firestore/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function CsrTestRunner() {

app/tests/functions/components/csr_test_runner.tsx src/components/app_tests/functions/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testFunctions, initializeTestResults } from '../lib/test';
20+
import { testFunctions, initializeTestResults } from '@/lib/app_tests/functions/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function CsrTestRunner() {

app/tests/messaging/components/csr_test_runner.tsx src/components/app_tests/messaging/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testMessaging, initializeTestResults } from '../lib/test';
20+
import { testMessaging, initializeTestResults } from '@/lib/app_tests/messaging/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function CsrTestRunner() {

app/tests/performance/components/csr_test_runner.tsx src/components/app_tests/performance/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testPerformance, initializeTestResults } from '../lib/test';
20+
import { testPerformance, initializeTestResults } from '@/lib/app_tests/performance/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function CsrTestRunner() {

app/tests/storage/components/csr_test_runner.tsx src/components/app_tests/storage/csr_test_runner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'use client'
1818

1919
import { useState, useEffect } from 'react'
20-
import { testStorage, initializeTestResults } from '../lib/test';
20+
import { testStorage, initializeTestResults } from '@/lib/app_tests/storage/test';
2121
import ResultsDisplay from './results_display';
2222

2323
export default function CsrTestRunner() {

app/tests/analytics/lib/test.ts src/lib/app_tests/analytics/test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
*/
1717
import { deleteApp, initializeApp } from 'firebase/app';
1818
import { getAnalytics, logEvent, isSupported } from 'firebase/analytics';
19-
import { firebaseConfig } from 'lib/firebase';
20-
import { OK, OK_SKIPPED, FAILED, sleep } from 'lib/util';
19+
import { firebaseConfig } from '@/lib/app_tests/firebase';
20+
import { OK, OK_SKIPPED, FAILED, sleep } from '@/lib/app_tests/util';
2121

2222
export type TestResults = {
2323
initializeAppResult: string,
@@ -38,9 +38,9 @@ export function initializeTestResults(): TestResults {
3838
return testAnalyticsResult;
3939
}
4040

41-
export async function testAnalytics(isServerApp: boolean = false): Promise<TestResults> {
41+
export async function testAnalytics(isServer: boolean = false): Promise<TestResults> {
4242
const result: TestResults = initializeTestResults();
43-
if (isServerApp) {
43+
if (isServer) {
4444
try {
4545
// Note: Analytics isn't supported in node environments.
4646
const firebaseApp = initializeApp(firebaseConfig);
@@ -58,7 +58,7 @@ export async function testAnalytics(isServerApp: boolean = false): Promise<TestR
5858
} catch (e) {
5959
console.log("Caught error: ", e);
6060
}
61-
} else /* !isServer() */ {
61+
} else /* !isServer */ {
6262
try {
6363
const firebaseApp = initializeApp(firebaseConfig);
6464
if (firebaseApp !== null) {
@@ -74,7 +74,7 @@ export async function testAnalytics(isServerApp: boolean = false): Promise<TestR
7474
result.logEventResult = OK;
7575
}
7676
// logEvent throws an error if we delete the app here, due to
77-
// it's asynchronous behavior.
77+
// its asynchronous behavior.
7878
await sleep(1000);
7979
deleteApp(firebaseApp);
8080
result.deleteAppResult = OK;

app/tests/app/lib/test.ts src/lib/app_tests/app/test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* limitations under the License.
1616
*/
1717
import { getApp, deleteApp, initializeApp, initializeServerApp } from 'firebase/app';
18-
import { firebaseConfig } from 'lib/firebase';
19-
import { OK, OK_SKIPPED, FAILED } from 'lib/util';
18+
import { firebaseConfig } from '@/lib/app_tests/firebase';
19+
import { OK, OK_SKIPPED, FAILED } from '@/lib/app_tests/util';
2020

2121
export type TestResults = {
2222
initializeAppResult: string,

app/tests/app_check/lib/test.ts src/lib/app_tests/app_check/test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
*/
1717
import { deleteApp, initializeApp } from 'firebase/app';
1818
import { AppCheckToken, CustomProvider, initializeAppCheck, getToken } from 'firebase/app-check';
19-
import { firebaseConfig } from 'lib/firebase';
20-
import { OK, FAILED } from 'lib/util';
19+
import { firebaseConfig } from '@/lib/app_tests/firebase';
20+
import { OK, FAILED } from '@/lib/app_tests/util';
2121

2222
export type TestResults = {
2323
initializeAppResult: string,

app/tests/auth/lib/test.ts src/lib/app_tests/auth/test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
*/
1717
import { deleteApp, initializeApp, initializeServerApp } from 'firebase/app';
1818
import { deleteUser, getAuth, signInAnonymously } from 'firebase/auth';
19-
import { firebaseConfig } from 'lib/firebase';
20-
import { OK, OK_SKIPPED, FAILED, waitForUserSignIn } from 'lib/util';
19+
import { firebaseConfig } from '@/lib/app_tests/firebase';
20+
import { OK, OK_SKIPPED, FAILED, waitForUserSignIn } from '@/lib/app_tests/util';
2121

2222
export type TestResults = {
2323
initializeAppResult: string,

app/tests/database/lib/test.ts src/lib/app_tests/database/test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import { deleteApp, initializeApp } from 'firebase/app';
1919
import { getDatabase, update, off, onValue, ref, remove, set } from 'firebase/database';
20-
import { firebaseConfig } from 'lib/firebase';
21-
import { OK, OK_SKIPPED, FAILED } from 'lib/util';
20+
import { firebaseConfig } from '@/lib/app_tests/firebase';
21+
import { OK, OK_SKIPPED, FAILED } from '@/lib/app_tests/util';
2222

2323
export type TestResults = {
2424
initializeAppResult: string,
@@ -101,7 +101,6 @@ export async function testDatabase(isServer: boolean = false): Promise<TestResul
101101
}
102102
});
103103
await remove(dbRef);
104-
console.log("remove returned");
105104
off(dbRef);
106105

107106
result.deleteRemoveValueListenerResult = OK;
File renamed without changes.

0 commit comments

Comments
 (0)