Skip to content

Commit

Permalink
Pr Updates. Added Unit Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds committed Dec 23, 2019
1 parent e035f4a commit 70d1496
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
2 changes: 0 additions & 2 deletions bcrs-ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<link rel="icon" href="dummy-not-used-do-not-remove">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="preload" href="<%= BASE_URL %>fonts/materialdesignicons-webfont.927457ed.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="<%= BASE_URL %>css/addresscomplete-2.00.min.css">
<script type="text/javascript" src="<%= BASE_URL %>js/addresscomplete-2.00.min.js" defer></script>
</head>
<body>
<noscript>
Expand Down
4 changes: 2 additions & 2 deletions bcrs-ui/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<div id="app">
<v-app id="app">
<div class="app-body">
<main>
<router-view />
</main>
</div>

</div>
</v-app>
</template>

<script lang="ts">
Expand Down
4 changes: 4 additions & 0 deletions bcrs-ui/src/mixins/resource-lookup-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export default class ResourceLookupMixin extends Vue {

/**
* Method to return the specified message
*
* @param id ID a number indicating the id of the resource to look up.
*/
getName (id: number): string {
const user: ResourceExampleIF | undefined = this.resourceModel && this.resourceModel.find(user => user.id === id)
Expand All @@ -22,6 +24,8 @@ export default class ResourceLookupMixin extends Vue {

/**
* Method to return the specified display Name
*
* @param id ID a number indicating the id of the resource to look up.
*/
getMessage (id: number): string {
const user: ResourceExampleIF | undefined = this.resourceModel && this.resourceModel.find(user => user.id === id)
Expand Down
1 change: 0 additions & 1 deletion bcrs-ui/src/utils/config-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import axios from '@/utils/axios-auth'
* @return A Promise to get & set session storage URLS with appropriate paths
*/
export const fetchConfig = (): Promise<any> => {
console.log('Fetch Config called')
const origin: string = window.location.origin
const vueAppPath: string = process.env.VUE_APP_PATH
const vueAppAuthPath:string = process.env.VUE_APP_AUTH_PATH
Expand Down
2 changes: 1 addition & 1 deletion bcrs-ui/src/views/StateExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { StateModelIF, ActionBindingIF } from '@/interfaces'
ResourceExample
}
})
export default class Testing extends Mixins(ResourceLookupMixin) {
export default class StateExample extends Mixins(ResourceLookupMixin) {
// Initialize State
@State stateModel!: StateModelIF
Expand Down
35 changes: 35 additions & 0 deletions bcrs-ui/tests/unit/stateExample.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Libraries
import Vue from 'vue'
import Vuetify from 'vuetify'
import { store } from '@/store'
import { shallowMount } from '@vue/test-utils'

// Components
import StateExample from '@/views/StateExample.vue'
import { ResourceExample } from '@/components/common'

Vue.use(Vuetify)
let vuetify = new Vuetify({})

describe('HelloWorld.vue', () => {
let wrapper: any

beforeEach(() => {
// create wrapper for Dashboard
// this stubs out the sub-component
wrapper = shallowMount(StateExample, { store, vuetify })
})

afterEach(() => {
wrapper.destroy()
})

it('renders the sub-components properly', () => {
expect(wrapper.find(ResourceExample).exists()).toBe(true)
})

it('displays the appropriate welcome message', () => {
expect(wrapper.vm.$el.querySelector('.stateExample').textContent)
.toContain('Congratulations... it worked!')
})
})

0 comments on commit 70d1496

Please sign in to comment.