-
Notifications
You must be signed in to change notification settings - Fork 3
Pull request for homework 7 #10
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
Open
florianthom
wants to merge
23
commits into
main
Choose a base branch
from
feature/homework-7
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9d73893
Adjusted storybook
florianthom 3d9211c
WIP user-login
florianthom ec2d3e0
Extended JWT payload
christophstach cd8ee21
Vuex store is now typed and persisted
christophstach d639fd4
WIP
christophstach 0075061
WIP
christophstach 609f5bf
Changed name
christophstach c48a4a4
Make table responsive.
christophstach 136ed8a
Minor changes
florianthom f1fcbf3
Minor changes
florianthom 20ca926
Started fixing the tests
s0557917 6e6c803
Smaller tests on test functions to determine errors
s0557917 bf8382d
Fixed typescript support for tests and added store support.
christophstach ef2bcd7
Fixed lint errors in backend.
christophstach f032d61
Removed local vue instance from test and adjusted test name according…
florianthom 57bc982
Continued work on tests
florianthom 6cea8f9
Added mock functions for apolloHelpers and apolloClient
s0557917 258b88f
Finished LoginForm tests
s0557917 8eb467a
Reworked README to add production installation steps
s0557917 846365e
Added dev command to the webapp README
s0557917 9800388
Fixed small error when throwing an exception, according to the linter
s0557917 87e7dff
Removed bearer from nuxt config
s0557917 7ee4b2b
Add loading indicator and cleaned unit tests
christophstach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,4 +1,6 @@ | ||
| export interface JwtPayload { | ||
| id: string; | ||
| name: string; | ||
| email: string; | ||
| iat?: number; | ||
| } |
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,4 +1,4 @@ | ||
| # nuxt-webapp | ||
| # webapp | ||
|
|
||
| ## Build Setup | ||
|
|
||
|
|
||
This file contains hidden or 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,11 @@ | ||
| import LoginForm from '~/components/LoginForm/LoginForm.vue' | ||
| import { setupWrapperAndStore } from '~/utils/tests' | ||
|
|
||
| describe('Login form tests', () => { | ||
| it('Tests True', () => { | ||
| const { wrapper, storeAccessor } = setupWrapperAndStore(LoginForm) | ||
|
|
||
| expect(wrapper).toBeTruthy() | ||
| expect(storeAccessor).toBeTruthy() | ||
| }) | ||
| }) |
This file contains hidden or 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,27 @@ | ||
| import NewsItem from './NewsItem.vue' | ||
|
|
||
| const newsItem = { | ||
| id: 1, | ||
| title: 'Test News Item', | ||
| votes: 0, | ||
| } | ||
|
|
||
| export default { | ||
| title: 'NewsItem', | ||
| component: NewsItem, | ||
| argTypes: { | ||
| update: { action: 'down- or upvote event action' }, | ||
| remove: { action: 'remove-event action' }, | ||
| }, | ||
| } | ||
|
|
||
| const Template = (args, { argTypes }) => ({ | ||
| props: Object.keys(argTypes), | ||
| components: { NewsItem }, | ||
| template: '<NewsItem @update="update" @remove="remove" v-bind="$props" />', | ||
| }) | ||
|
|
||
| export const Default = Template.bind({}) | ||
| Default.args = { | ||
| newsItem, | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,7 +1,9 @@ | ||
| import { createLocalVue, mount } from '@vue/test-utils' | ||
| import NewsList from '@/components/NewsList/NewsList.vue' | ||
| import NewsItem from '@/components/NewsItem/NewsItem.vue' | ||
| import { createLocalVue } from '@vue/test-utils' | ||
| import Vuex from 'vuex' | ||
| import NewsItem from '../NewsItem/NewsItem.vue' | ||
| import NewsList from './NewsList.vue' | ||
| import { NewsItemModel } from '~/models/news-item.model' | ||
| import { setupWrapperAndStore } from '~/utils/tests' | ||
|
|
||
| const newsItemsMock = [ | ||
| new NewsItemModel({ | ||
|
|
@@ -21,7 +23,7 @@ const newsItemsMock = [ | |
| author: { | ||
| id: '1', | ||
| name: 'Christoph Stach', | ||
| email: 's0555912@htw-berlin.de', | ||
| email: 's0555912@htw-berlisn.de', | ||
| }, | ||
| }), | ||
| new NewsItemModel({ | ||
|
|
@@ -38,56 +40,45 @@ const newsItemsMock = [ | |
|
|
||
| describe('NewsList', () => { | ||
| const localVue = createLocalVue() | ||
| localVue.use(Vuex) | ||
|
|
||
| it('exists', () => { | ||
| const wrapper = mount(NewsList, { | ||
| localVue, | ||
| it('should exist', () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use |
||
| const { wrapper, storeAccessor } = setupWrapperAndStore(NewsList, { | ||
| newsItems: [], | ||
| }) | ||
|
|
||
| expect(wrapper).toBeTruthy() | ||
| expect(storeAccessor).toBeTruthy() | ||
| }) | ||
|
|
||
| it('renders no news items', () => { | ||
| const wrapper = mount(NewsList, { | ||
| localVue, | ||
| data() { | ||
| return { newsItems: [] } | ||
| }, | ||
| const { wrapper, storeAccessor } = setupWrapperAndStore(NewsList, { | ||
| newsItems: [], | ||
| }) | ||
|
|
||
| expect(wrapper.findAllComponents(NewsItem)).toHaveLength(0) | ||
| }) | ||
|
|
||
| it('renders news item', () => { | ||
| const wrapper = mount(NewsList, { | ||
| localVue, | ||
| data() { | ||
| return { newsItems: newsItemsMock } | ||
| }, | ||
| const { wrapper, storeAccessor } = setupWrapperAndStore(NewsList, { | ||
| newsItems: newsItemsMock, | ||
| }) | ||
|
|
||
| expect(wrapper.findAllComponents(NewsItem)).toHaveLength(3) | ||
| }) | ||
|
|
||
| it('renders empty list message', () => { | ||
| const emptyMessage = 'No News in the list!' | ||
|
|
||
| const wrapper = mount(NewsList, { | ||
| localVue, | ||
| data() { | ||
| return { newsItems: [] } | ||
| }, | ||
| const { wrapper, storeAccessor } = setupWrapperAndStore(NewsList, { | ||
| newsItems: [], | ||
| }) | ||
|
|
||
| expect(wrapper.text()).toMatch(emptyMessage) | ||
| }) | ||
|
|
||
| it('check order: check initial order before clicking the toggle-button', () => { | ||
| const wrapper = mount(NewsList, { | ||
| localVue, | ||
| data() { | ||
| return { newsItems: newsItemsMock } | ||
| }, | ||
| const { wrapper, storeAccessor } = setupWrapperAndStore(NewsList, { | ||
| newsItems: newsItemsMock, | ||
| }) | ||
|
|
||
| const votes = wrapper | ||
|
|
@@ -98,11 +89,8 @@ describe('NewsList', () => { | |
| }) | ||
|
|
||
| it('toggles between ascending and descending order', async () => { | ||
| const wrapper = mount(NewsList, { | ||
| localVue, | ||
| data() { | ||
| return { newsItems: newsItemsMock } | ||
| }, | ||
| const { wrapper, storeAccessor } = setupWrapperAndStore(NewsList, { | ||
| newsItems: newsItemsMock, | ||
| }) | ||
|
|
||
| const button = wrapper.find('[data-test-toggle]') | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Anonymizing your personal data? 😉