Skip to content

Commit

Permalink
Adding stories for Lock (#227)
Browse files Browse the repository at this point in the history
* Adding Lock stories

* Minor style changes
  • Loading branch information
benwerd committed Sep 7, 2018
1 parent be453a7 commit ad81515
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions unlock-app/src/stories/creator/Lock.stories.js
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} />
)
})

0 comments on commit ad81515

Please sign in to comment.