-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: first pieces for The Forest (#475)
* feat: first pieces for The Forest add the beginnings of the forest behind a feature flag - add feature flag - add new view and insert into navigation - add forest unlock to levelEntitlements - add some strings for forest notifications - add some constants for forest sizes - add purchasable upgrade to shop for forest upgrades - move `unlockTool` to be a reducer and add missing unit tests - refactor `Shop` unit tests to use RTL --------- Co-authored-by: Jeremy Kahn <jeremyckahn@gmail.com>
- Loading branch information
1 parent
de83ce7
commit 6968f21
Showing
25 changed files
with
376 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react' | ||
|
||
export const Forest = () => { | ||
return <div>'welcome to da forest'</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Forest } from './Forest' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,50 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import { render, screen } from '@testing-library/react' | ||
|
||
import Inventory from '../Inventory' | ||
import { INFINITE_STORAGE_LIMIT } from '../../constants' | ||
import { noop } from '../../utils/noop' | ||
|
||
import { Shop } from './Shop' | ||
import FarmhandContext from '../Farmhand/Farmhand.context' | ||
|
||
let component | ||
import Shop from './Shop' | ||
|
||
beforeEach(() => { | ||
component = shallow( | ||
<Shop | ||
{...{ | ||
handleCombinePurchase: noop, | ||
handleCowPenPurchase: noop, | ||
handleCellarPurchase: noop, | ||
handleFieldPurchase: noop, | ||
handleStorageExpansionPurchase: noop, | ||
inventoryLimit: INFINITE_STORAGE_LIMIT, | ||
money: 0, | ||
purchasedCombine: 0, | ||
purchasedCowPen: 0, | ||
purchasedCellar: 0, | ||
purchasedSmelter: 0, | ||
purchasedField: 0, | ||
shopInventory: [], | ||
toolLevels: {}, | ||
valueAdjustments: {}, | ||
}} | ||
/> | ||
const gameState = { | ||
inventoryLimit: INFINITE_STORAGE_LIMIT, | ||
levelEntitlements: { | ||
stageFocusType: {}, | ||
}, | ||
money: 0, | ||
purchasedCombine: 0, | ||
purchasedCowPen: 0, | ||
purchasedCellar: 0, | ||
purchasedSmelter: 0, | ||
purchasedField: 0, | ||
shopInventory: [], | ||
toolLevels: {}, | ||
valueAdjustments: {}, | ||
} | ||
|
||
const handlers = { | ||
handleCombinePurchase: noop, | ||
handleCowPenPurchase: noop, | ||
handleCellarPurchase: noop, | ||
handleFieldPurchase: noop, | ||
handleStorageExpansionPurchase: noop, | ||
} | ||
|
||
render( | ||
<FarmhandContext.Provider value={{ gameState, handlers }}> | ||
<Shop /> | ||
</FarmhandContext.Provider> | ||
) | ||
}) | ||
|
||
test('renders shop inventory', () => { | ||
expect(component.find(Inventory)).toHaveLength(2) | ||
describe('<Shop />', () => { | ||
test.each(['Seeds', 'Supplies', 'Upgrades'])( | ||
'the %s tab exists', | ||
tabLabel => { | ||
expect(screen.getByText(tabLabel)).toBeInTheDocument() | ||
} | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.