Skip to content

Commit

Permalink
feat(test): add custom _provider and _scheme for basic fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Apr 2, 2018
1 parent b7998c6 commit 7423e77
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions test/fixtures/basic/auth/test-provider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function test (scheme) {
scheme._with_test_provider = true
}
11 changes: 11 additions & 0 deletions test/fixtures/basic/auth/test-scheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default class LocalScheme {
constructor (auth, options) {
this.$auth = auth
this.name = options._name
}

mounted () {
// eslint-disable-next-line no-console
console.log('Mounted test provider: ' + this.name)
}
}
4 changes: 4 additions & 0 deletions test/fixtures/basic/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ module.exports = {
endpoints: {
login: { propertyName: 'token.accessToken' }
}
},
test: {
_provider: '~/auth/test-provider.js',
_scheme: '~/auth/test-scheme.js'
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/basic/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div>
{{ $auth.$state.loggedIn ? 'Logged In' : 'Guest' }}
<pre v-if="$auth.loggedIn" v-html="$auth.user"></pre>
<div v-else>Please login</div>
</div>
</template>

0 comments on commit 7423e77

Please sign in to comment.