Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit test TS errors #7860

Merged
merged 2 commits into from
Mar 18, 2023
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
8 changes: 4 additions & 4 deletions packages/internal/src/__tests__/nestedPages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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', () => {
Expand Down
9 changes: 5 additions & 4 deletions packages/structure/src/model/__tests__/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -78,16 +78,17 @@ 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 () => {
const projectRoot = getFixtureDir('example-todo-main-with-errors')
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'
)
})
Expand Down