Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion js-sdk-framework-tests/nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"extends": [
"next/core-web-vitals",
"next/typescript"
]
],
"rules": {
"@typescript-eslint/no-require-imports": "off"
}
}
6 changes: 6 additions & 0 deletions js-sdk-framework-tests/nextjs/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export default async function Page() {
<li><Link href="/tests/auth/web_ssr">Auth Web SDK server-side tests</Link></li>
</ul>
<p />
<li>Data Connect</li>
<ul>
<li><Link href="/tests/data_connect/web_client">Data Connect Web SDK client-side tests</Link></li>
<li><Link href="/tests/data_connect/web_ssr">Data Connect Web SDK server-side tests</Link></li>
</ul>
<p />
<li>Database</li>
<ul>
<li><Link href="/tests/database/web_client">Database Web SDK client-side tests</Link></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Metadata } from 'next'
import CSRTestRunner from '@/components/app_tests/data_connect/csr_test_runner';

export const metadata: Metadata = {
title: 'Data Connect Web SDK CSR test'
}

export default function Page() {
return (
<>
<h1>Data Connect CSR Test results:</h1>
<CSRTestRunner />
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { Metadata } from 'next'
import { testDataConnect, TestResults } from '@/lib/app_tests/data_connect/test';
import ResultsDisplay from '@/components/app_tests/data_connect/results_display';

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

export const metadata: Metadata = {
title: 'Data Connect Web SDK SSR test'
}

export default async function Page() {
const testResults: TestResults = await testDataConnect(/*isServer=*/true);
return (
<>
<h1>Data Connect SSR Test results:</h1>
<ResultsDisplay statusString='Tests Complete!' testResults={testResults} />
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use client'

import { useState, useEffect } from 'react'
import { testDataConnect, initializeTestResults } from '@/lib/app_tests/data_connect/test';
import ResultsDisplay from './results_display';

export default function CsrTestRunner() {
const [testStatus, setTestStatus] = useState<string>("running...");
const [testResults, setTestResults] = useState(initializeTestResults());
useEffect(() => {
const asyncTest = async () => {
setTestResults(await testDataConnect());
setTestStatus("Complete!");
}
asyncTest().catch((e) => {
console.error("Error encountered during testing: ", e);
setTestStatus("Errored!");
});
}, []);

return (
<ResultsDisplay statusString={testStatus} testResults={testResults} />
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Link from 'next/link';
export default function ResultsDisplay({ statusString, testResults }) {
return (
<>
<h2 title="testStatus">{statusString}</h2>
<h4 title="initializeAppResult">initializeAppResult: {testResults.initializeAppResult}</h4>
<h4 title="initializeAuthResult">initializeAuthResult: {testResults.initializeAppResult}</h4>
<h4 title="signInAnonymouslyresult">signInAnonymouslyresult: {testResults.initializeAppResult}</h4>
<h4 title="addPostResult">addPostResult: {testResults.initializeAppResult}</h4>
<h4 title="listPostsResult">listPostsResult: {testResults.initializeAppResult}</h4>
<h4 title="foundPostResult">foundPostResult: {testResults.initializeAppResult}</h4>
<h4 title="removePostResult">removePostResult: {testResults.initializeAppResult}</h4>
<h4 title="requeryPostsResult">requeryPostsResult: {testResults.initializeAppResult}</h4>
<h4 title="confirmedPostDeletedResult">confirmedPostDeletedResult: {testResults.initializeAppResult}</h4>
<h4 title="deleteUserResult">deleteUserResult: {testResults.initializeAppResult}</h4>
<h4 title="deleteAppResult">deleteAppResult: {testResults.initializeAppResult}</h4>
<p />
<Link href="/">Back to test index</Link>
</>
);
}
Loading