Skip to content

Commit

Permalink
fix(tests): Adjust node tests to use vitest
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Nov 8, 2023
1 parent a4be60f commit 8f1e713
Show file tree
Hide file tree
Showing 10 changed files with 1,349 additions and 1,011 deletions.
25 changes: 14 additions & 11 deletions __mocks__/@nextcloud/axios.js
@@ -1,15 +1,18 @@
const axios = jest.createMockFromModule('@nextcloud/axios')
import wsData from './activity_ws.json'

const wsData = require('./activity_ws.json')

axios.get = function(url) {
return new Promise((resolve, reject) => {
if (url === 'http://localhost/ocs/v2.php/apps/activity/api/v2/activity/filter') {
resolve({ data: wsData })
} else {
reject(new Error(`URL not defined ${url}`))
}
})
const axios = {
/**
* @param {string} url URL to get
*/
get(url) {
return new Promise((resolve, reject) => {
if (url.endsWith('/ocs/v2.php/apps/activity/api/v2/activity/filter')) {
resolve({ data: wsData })
} else {
reject(new Error(`URL not defined ${url}`))
}
})
},
}

export default axios

0 comments on commit 8f1e713

Please sign in to comment.