diff --git a/packages/internal/src/__tests__/nestedPages.test.ts b/packages/internal/src/__tests__/nestedPages.test.ts index 631a6b0105c1..8360483c2b1b 100644 --- a/packages/internal/src/__tests__/nestedPages.test.ts +++ b/packages/internal/src/__tests__/nestedPages.test.ts @@ -7,8 +7,8 @@ import { getPaths } from '../paths' const FIXTURE_PATH = path.join(__dirname, 'fixtures/nestedPages') describe('User specified imports, with static imports', () => { - let outputWithStaticImports - let outputNoStaticImports + let outputWithStaticImports: string | null | undefined + let outputNoStaticImports: string | null | undefined beforeEach(() => { process.env.RWJS_CWD = FIXTURE_PATH cleanWebBuild() @@ -25,11 +25,11 @@ describe('User specified imports, with static imports', () => { outputWithStaticImports = prebuildWebFile(routesFile, { staticImports: true, forJest: true, - }).code + })?.code outputNoStaticImports = prebuildWebFile(routesFile, { forJest: true, - }).code + })?.code }) it('Imports layouts correctly', () => { diff --git a/packages/structure/src/model/__tests__/model.test.ts b/packages/structure/src/model/__tests__/model.test.ts index 9ebbeccf7303..e55ae60dc7f2 100644 --- a/packages/structure/src/model/__tests__/model.test.ts +++ b/packages/structure/src/model/__tests__/model.test.ts @@ -41,7 +41,7 @@ describe('Redwood Project Model', () => { const uri = URL_file(projectRoot, 'api/src/graphql/todos.sdl.js') const node = await project.findNode(uri) expect(node).toBeDefined() - expect(node.id).toEqual(uri) + expect(node?.id).toEqual(uri) if (node) { const info = await node.collectIDEInfo() info.length @@ -78,7 +78,7 @@ describe('Cells', () => { const projectRoot = getFixtureDir('example-todo-main') const project = new RWProject({ projectRoot, host: new DefaultHost() }) const cell = project.cells.find((x) => x.uri.endsWith('TodoListCell.tsx')) - expect(cell.queryOperationName).toMatch('TodoListCell_GetTodos') + expect(cell?.queryOperationName).toMatch('TodoListCell_GetTodos') }) it('Warns you when you do not supply a name to QUERY', async () => { @@ -86,8 +86,9 @@ describe('Cells', () => { const project = new RWProject({ projectRoot, host: new DefaultHost() }) const cell = project.cells.find((x) => x.uri.endsWith('TodoListCell.js')) - const x = await cell.collectDiagnostics() - expect(x.map((e) => e.diagnostic.message)).toContain( + const x = await cell?.collectDiagnostics() + expect(x).not.toBeUndefined() + expect(x?.map((e) => e.diagnostic.message)).toContain( 'We recommend that you name your query operation' ) })