massive refactor toDrop cascadeStudio and add CadQuery + OpenSCAD

resolves #400
This commit is contained in:
Kurt Hutten
2021-07-08 21:17:07 +10:00
parent 477a557eb8
commit 8e558d2342
158 changed files with 2335 additions and 2300 deletions

View File

@@ -0,0 +1,6 @@
// Define your own mock data here:
export const standard = (/* vars, { ctx, req } */) => ({
projectsOfUser: {
id: 42,
},
})

View File

@@ -0,0 +1,20 @@
import { Loading, Empty, Failure, Success } from './ProjectsOfUserCell'
import { standard } from './ProjectsOfUserCell.mock'
export const loading = () => {
return Loading ? <Loading /> : null
}
export const empty = () => {
return Empty ? <Empty /> : null
}
export const failure = () => {
return Failure ? <Failure error={new Error('Oh no')} /> : null
}
export const success = () => {
return Success ? <Success {...standard()} /> : null
}
export default { title: 'Cells/ProjectsOfUserCell' }

View File

@@ -0,0 +1,21 @@
import { render, screen } from '@redwoodjs/testing'
import { Loading, Empty, Success } from './ProjectsOfUserCell'
import { standard } from './ProjectsOfUserCell.mock'
describe('ProjectsOfUserCell', () => {
test('Loading renders successfully', () => {
render(<Loading />)
// Use screen.debug() to see output
expect(screen.getByText('Loading...')).toBeInTheDocument()
})
test('Empty renders successfully', async () => {
render(<Empty />)
expect(screen.getByText('Empty')).toBeInTheDocument()
})
test('Success renders successfully', async () => {
render(<Success projectsOfUser={standard().projectsOfUser} />)
expect(screen.getByText(/42/i)).toBeInTheDocument()
})
})

View File

@@ -0,0 +1,40 @@
import { Link, routes } from '@redwoodjs/router'
import Projects from 'src/components/Projects/Projects'
export const QUERY = gql`
query PROJECTS_OF_USER($userName: String!) {
projects(userName: $userName) {
id
title
mainImage
createdAt
updatedAt
user {
image
userName
}
Reaction {
emote
}
}
}
`
export const Loading = () => <div>Loading...</div>
export const Empty = () => {
return <div className="rw-text-center">No projects yet.</div>
}
export const Success = ({
projects,
variables: { shouldFilterProjectsWithoutImage },
}) => {
return (
<Projects
projects={projects}
shouldFilterProjectsWithoutImage={shouldFilterProjectsWithoutImage}
/>
)
}