Skip to content

Commit 97c477f

Browse files
committed
update tests
1 parent 47afb06 commit 97c477f

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

test/axios.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const testSuite = () => {
3232
const call = addTemplate.mock.calls.find(args => args[0].src.includes('plugin.js'))
3333
const options = call[0].options
3434
const proto = options.https ? 'https' : 'http'
35-
expect(options.baseURL.toString()).toBe(`${proto}://localhost:3000/api/test`)
36-
expect(options.browserBaseURL.toString()).toBe('/api/test')
35+
expect(options.baseURL.toString()).toBe(`${proto}://localhost:3000/api`)
36+
expect(options.browserBaseURL.toString()).toBe('/api')
3737
})
3838

3939
test('asyncData', async () => {
@@ -121,7 +121,7 @@ describe('module', () => {
121121
describe('other options', () => {
122122
beforeAll(async () => {
123123
config.axios = {
124-
prefix: '/api/test',
124+
prefix: '/api',
125125
proxy: {},
126126
credentials: true,
127127
https: true,
@@ -141,7 +141,7 @@ describe('other options', () => {
141141
describe('browserBaseURL', () => {
142142
beforeAll(async () => {
143143
config.axios = {
144-
browserBaseURL: '/api/test'
144+
browserBaseURL: '/api'
145145
}
146146

147147
await setupNuxt(config)
@@ -156,7 +156,7 @@ describe('browserBaseURL', () => {
156156
const call = addTemplate.mock.calls.find(args => args[0].src.includes('plugin.js'))
157157
const options = call[0].options
158158
expect(options.baseURL.toString()).toBe('http://localhost:3000/')
159-
expect(options.browserBaseURL.toString()).toBe('/api/test')
159+
expect(options.browserBaseURL.toString()).toBe('/api')
160160
})
161161
})
162162

File renamed without changes.

test/fixture/nuxt.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
{ handler: require('../../') }
1212
],
1313
serverMiddleware: {
14-
'/api/test': '~/api/test',
14+
'/api/echo': '~/api/echo',
1515
'/api/cookie': '~/api/cookie'
1616
},
1717
axios: {

test/fixture/pages/asyncData.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<script>
88
export default {
99
async asyncData ({ app }) {
10-
const res = await app.$axios.$get('foo/bar')
10+
const res = await app.$axios.$get('echo/foo/bar')
1111
return {
1212
res
1313
}

test/fixture/pages/cancelToken.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
const source = this.$axios.CancelToken.source()
1515
this.$axios
1616
.$post(
17-
'http://localhost:3000/api/test/foo/bar?delay=1000',
17+
'http://localhost:3000/api/echo/foo/bar?delay=1000',
1818
{ data: 'test' },
1919
{
2020
cancelToken: source.token

test/fixture/pages/mounted.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
1515
async mounted () {
1616
// Request with full url becasue we are in JSDom env
17-
this.res = await this.$axios.$get('http://localhost:3000/api/test/foo/bar')
17+
this.res = await this.$axios.$get('http://localhost:3000/api/echo/foo/bar')
1818
}
1919
}
2020
</script>

test/fixture/pages/ssr.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ export default {
2020
},
2121
computed: {
2222
axiosSessionId () {
23-
return this.$axios.defaults.defaultHeaders.SessionId
23+
return this.$axios.defaults.headers.common.SessionId
2424
},
2525
axiosEncoding () {
26-
return this.$axios.defaults.defaultHeaders['accept-encoding']
26+
return this.$axios.defaults.headers.common['accept-encoding']
2727
},
2828
newInstanceSessionId () {
29-
return this.newInstance.defaults.defaultHeaders.SessionId
29+
return this.newInstance.defaults.headers.common.SessionId
3030
},
3131
newInstanceHeaders () {
32-
return this.newInstance.defaults.defaultHeaders
32+
return this.newInstance.defaults.headers.common
3333
}
3434
},
3535
created () {

0 commit comments

Comments
 (0)