-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat(project): Replace Create React App with Vite #506
Conversation
chore(config): treat .js files as .jsx chore(project): rename .jsx files to .js
chore(project): [wip] await importActual
chore(project): [wip] fix broken test chore(project): [wip] fix broken test chore(project): [wip] fix broken test chore(project): [wip] fix broken test chore(project): [wip] fix broken test chore(project): [wip] fix broken test
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
describe('fertilize-mode class', () => { | ||
test('is not present when fieldMode != FERTILIZE', () => { | ||
expect(component.find('.Field').hasClass('fertilize-mode')).toBeFalsy() | ||
}) | ||
|
||
test('is present when fieldMode == FERTILIZE', () => { | ||
component.setProps({ fieldMode: fieldMode.FERTILIZE }) | ||
expect(component.find('.Field').hasClass('fertilize-mode')).toBeTruthy() | ||
}) | ||
}) | ||
|
||
describe('plant-mode class', () => { | ||
test('is not present when fieldMode != PLANT', () => { | ||
expect(component.find('.Field').hasClass('plant-mode')).toBeFalsy() | ||
}) | ||
|
||
test('is present when fieldMode == PLANT', () => { | ||
component.setProps({ fieldMode: fieldMode.PLANT }) | ||
expect(component.find('.Field').hasClass('plant-mode')).toBeTruthy() | ||
}) | ||
}) | ||
|
||
describe('harvest-mode class', () => { | ||
test('is not present when fieldMode != HARVEST', () => { | ||
expect(component.find('.Field').hasClass('harvest-mode')).toBeFalsy() | ||
}) | ||
|
||
test('is present when fieldMode == HARVEST', () => { | ||
component.setProps({ fieldMode: fieldMode.HARVEST }) | ||
expect(component.find('.Field').hasClass('harvest-mode')).toBeTruthy() | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These and the removed tests below are obviated by src/shell/field.test.js
, introduced by this PR:
farmhand/src/shell/field.test.js
Lines 15 to 81 in 2b8721e
describe('field interaction', () => { | |
beforeEach(async () => { | |
const loadedState = saveDataStubFactory({ | |
purchasedCowPen: 1, | |
inventory: [ | |
{ id: carrotSeed.id, quantity: 1 }, | |
{ id: fertilizer.id, quantity: 1 }, | |
], | |
}) | |
await farmhandStub({ | |
localforage: { | |
getItem: () => Promise.resolve(loadedState), | |
setItem: (_key, data) => Promise.resolve(data), | |
}, | |
}) | |
// NOTE: Navigates to Field | |
await nextView() | |
await nextView() | |
}) | |
test('can enable water mode', async () => { | |
const field = screen.getByTestId('field') | |
const wateringCanButton = screen.getByAltText(WATERING_CAN_ALT_TEXT) | |
expect(field).not.toHaveClass('water-mode') | |
userEvent.click(wateringCanButton) | |
expect(field).toHaveClass('water-mode') | |
}) | |
test('can enable cleanup mode', async () => { | |
const field = screen.getByTestId('field') | |
const hoeButton = screen.getByAltText(HOE_ALT_TEXT) | |
expect(field).not.toHaveClass('cleanup-mode') | |
userEvent.click(hoeButton) | |
expect(field).toHaveClass('cleanup-mode') | |
}) | |
test('can enable harvest mode', async () => { | |
const field = screen.getByTestId('field') | |
const scytheButton = screen.getByAltText(SCYTHE_ALT_TEXT) | |
expect(field).not.toHaveClass('harvest-mode') | |
userEvent.click(scytheButton) | |
expect(field).toHaveClass('harvest-mode') | |
}) | |
test('can enable plant mode', async () => { | |
const field = screen.getByTestId('field') | |
const [, carrotSeedButton] = screen.getAllByAltText(carrotSeed.name) | |
expect(field).not.toHaveClass('plant-mode') | |
userEvent.click(carrotSeedButton) | |
expect(field).toHaveClass('plant-mode') | |
}) | |
test('can enable fertilize mode', async () => { | |
const field = screen.getByTestId('field') | |
const [, carrotSeedButton] = screen.getAllByAltText(fertilizer.name) | |
expect(field).not.toHaveClass('fertilize-mode') | |
userEvent.click(carrotSeedButton) | |
expect(field).toHaveClass('fertilize-mode') | |
}) | |
}) |
@@ -22,7 +22,7 @@ export const purchaseForest = (state, forestId) => { | |||
const { columns, price, rows } = PURCHASABLE_FOREST_SIZES.get(forestId) | |||
|
|||
/* | |||
* FIXME: using FOREST_AVAILABLE_NOTIFICATION here is temporary, this code path will | |||
* TODO: using FOREST_AVAILABLE_NOTIFICATION here is temporary, this code path will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @lstebner I changed this from a FIXME
to a TODO
. I find it helpful to treat FIXME
s as an indication that something that needs to be addressed before a PR is merged, whereas a TODO
indicates an improvement to be optionally made at some point in the future.
describe('fieldMode === PLANT', () => { | ||
beforeEach(() => { | ||
handlers().handleFieldModeSelect(fieldMode.PLANT) | ||
}) | ||
|
||
test('updates fieldMode state', () => { | ||
expect(component.state().fieldMode).toEqual(fieldMode.PLANT) | ||
}) | ||
|
||
test('does not change state.selectedItemId', () => { | ||
expect(component.state().selectedItemId).toEqual('sample-crop-3') | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These have also been obviated by src/shell/field.test.js
.
This reverts commit 4e05344.
What this PR does
Drop Create React App in favor of Vite. CRA is unmaintained, so this project would do well to transition to something more modern.
How this change can be validated
Questions or concerns about this change
I tried to keep the scope of this change as narrow as possible, but it still touches pretty much everything in the project. We'll probably find something broken after the fact, so we'll just have to fix forward if that's the case.