-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding Lock stories * Minor style changes
- Loading branch information
Showing
1 changed file
with
82 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import { Lock } from '../../components/consumer/Lock' | ||
import { Provider } from 'react-redux' | ||
import createUnlockStore from '../../createUnlockStore' | ||
|
||
let store = createUnlockStore() | ||
|
||
storiesOf('Lock') | ||
.addDecorator(story => <Provider store={store}>{story()}</Provider>) | ||
.add('With no key purchased', () => { | ||
const account = { | ||
address: '0xabc', | ||
} | ||
const lock = { | ||
keyPrice: '100', | ||
expirationDuration: '10', | ||
} | ||
const currentKey = { | ||
expiration: 0, | ||
} | ||
return ( | ||
<Lock currentKey={currentKey} account={account} lock={lock} /> | ||
) | ||
}) | ||
.add('With no key purchased, longer duration and a higher price', () => { | ||
const account = { | ||
address: '0xabc', | ||
} | ||
const lock = { | ||
keyPrice: '10000000000000000000', | ||
expirationDuration: '100', | ||
} | ||
const currentKey = { | ||
expiration: 0, | ||
} | ||
return ( | ||
<Lock currentKey={currentKey} account={account} lock={lock} /> | ||
) | ||
}) | ||
.add('With a valid key', () => { | ||
const account = { | ||
address: '0xabc', | ||
} | ||
const lock = { | ||
keyPrice: '100', | ||
expirationDuration: '10', | ||
} | ||
const currentKey = { | ||
expiration: (new Date().getTime() + 1000 * 60 * 60 * 24) / 1000, | ||
} | ||
return ( | ||
<Lock currentKey={currentKey} account={account} lock={lock} /> | ||
) | ||
}) | ||
.add('With an expired key', () => { | ||
const account = { | ||
address: '0xabc', | ||
} | ||
const lock = { | ||
keyPrice: '100', | ||
expirationDuration: '10', | ||
} | ||
const currentKey = { | ||
expiration: 1, | ||
} | ||
return ( | ||
<Lock currentKey={currentKey} account={account} lock={lock} /> | ||
) | ||
}) | ||
.add('With no lock', () => { | ||
const account = { | ||
address: '0xabc', | ||
} | ||
const lock = null | ||
const currentKey = { | ||
expiration: 0, | ||
} | ||
return ( | ||
<Lock currentKey={currentKey} account={account} lock={lock} /> | ||
) | ||
}) |