mirror of
https://github.com/Permissionless-Software-Foundation/x402-base-facilitator.git
synced 2026-09-21 16:52:01 -07:00
fix(unit tests): moved to separate unit test directory
This commit is contained in:
+2
-2
@@ -5,11 +5,11 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"test": "export KOA_ENV=test && npm run prep-test && nyc --reporter=text --timeout 15000 ./node_modules/.bin/mocha --exit",
|
||||
"test": "export KOA_ENV=test && npm run prep-test && nyc --reporter=text mocha --exit --timeout 15000 test/unit/",
|
||||
"lint": "standard --env mocha --fix",
|
||||
"docs": "./node_modules/.bin/apidoc -i src/ -o docs",
|
||||
"coverage": "export KOA_ENV=test && npm run prep-test && nyc report --reporter=text-lcov | coveralls",
|
||||
"coverage:report": "export KOA_ENV=test && npm run prep-test && nyc --reporter=html mocha --exit",
|
||||
"coverage:report": "export KOA_ENV=test && npm run prep-test && nyc --reporter=html mocha --exit --timeout 15000 test/unit/",
|
||||
"prep-test": "node util/users/delete-all-test-users.js"
|
||||
},
|
||||
"keywords": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const app = require('../bin/server')
|
||||
const app = require('../../bin/server')
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const config = require('../../config')
|
||||
const assert = require('chai').assert
|
||||
|
||||
const axios = require('axios').default
|
||||
@@ -1,6 +1,6 @@
|
||||
const testUtils = require('./utils')
|
||||
const assert = require('chai').assert
|
||||
const config = require('../config')
|
||||
const config = require('../../config')
|
||||
const axios = require('axios').default
|
||||
const sinon = require('sinon')
|
||||
|
||||
@@ -11,7 +11,7 @@ const LOCALHOST = `http://localhost:${config.port}`
|
||||
|
||||
const context = {}
|
||||
|
||||
const UserController = require('../src/modules/users/controller')
|
||||
const UserController = require('../../src/modules/users/controller')
|
||||
let uut
|
||||
let sandbox
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const assert = require('chai').assert
|
||||
|
||||
const NodeMailer = require('../src/lib/nodemailer')
|
||||
const NodeMailer = require('../../src/lib/nodemailer')
|
||||
|
||||
const sinon = require('sinon')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const config = require('../config')
|
||||
const config = require('../../config')
|
||||
const axios = require('axios').default
|
||||
const assert = require('chai').assert
|
||||
const sinon = require('sinon')
|
||||
@@ -9,7 +9,7 @@ const sinon = require('sinon')
|
||||
const LOCALHOST = `http://localhost:${config.port}`
|
||||
|
||||
const mockContext = require('./mocks/ctx-mock').context
|
||||
const ContactController = require('../src/modules/contact/controller')
|
||||
const ContactController = require('../../src/modules/contact/controller')
|
||||
let uut
|
||||
let sandbox
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const assert = require('chai').assert
|
||||
const PassportLib = require('../src/lib/passport')
|
||||
const PassportLib = require('../../src/lib/passport')
|
||||
|
||||
const sinon = require('sinon')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const config = require('../config')
|
||||
const config = require('../../config')
|
||||
const assert = require('chai').assert
|
||||
|
||||
const axios = require('axios').default
|
||||
@@ -9,7 +9,7 @@ util.inspect.defaultOptions = { depth: 1 }
|
||||
|
||||
const LOCALHOST = `http://localhost:${config.port}`
|
||||
|
||||
const LogsController = require('../src/modules/logapi/controller')
|
||||
const LogsController = require('../../src/modules/logapi/controller')
|
||||
const mockContext = require('./mocks/ctx-mock').context
|
||||
const mockData = require('./mocks/log-api-mock')
|
||||
|
||||
@@ -5,7 +5,7 @@ const sinon = require('sinon')
|
||||
const util = require('util')
|
||||
util.inspect.defaultOptions = { depth: 1 }
|
||||
|
||||
const JsonFiles = require('../src/lib/utils/json-files')
|
||||
const JsonFiles = require('../../src/lib/utils/json-files')
|
||||
|
||||
const JSON_FILE = 'test-json-file.json'
|
||||
const JSON_PATH = `${__dirname}/${JSON_FILE}`
|
||||
@@ -1,7 +1,7 @@
|
||||
const assert = require('chai').assert
|
||||
const testUtils = require('./utils')
|
||||
|
||||
const Validators = require('../src/middleware/validators')
|
||||
const Validators = require('../../src/middleware/validators')
|
||||
|
||||
const sinon = require('sinon')
|
||||
const mockContext = require('./mocks/ctx-mock').context
|
||||
@@ -1,6 +1,6 @@
|
||||
const assert = require('chai').assert
|
||||
|
||||
const Admin = require('../src/lib/admin')
|
||||
const Admin = require('../../src/lib/admin')
|
||||
|
||||
const sinon = require('sinon')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const mongoose = require('mongoose')
|
||||
const config = require('../config')
|
||||
const config = require('../../config')
|
||||
const axios = require('axios').default
|
||||
|
||||
const LOCALHOST = `http://localhost:${config.port}`
|
||||
@@ -79,7 +79,7 @@ async function loginTestUser () {
|
||||
|
||||
async function loginAdminUser () {
|
||||
try {
|
||||
const FILENAME = `../config/system-user-${config.env}.json`
|
||||
const FILENAME = `../../config/system-user-${config.env}.json`
|
||||
const adminUserData = require(FILENAME)
|
||||
console.log(`adminUserData: ${JSON.stringify(adminUserData, null, 2)}`)
|
||||
|
||||
@@ -115,7 +115,7 @@ async function getAdminJWT () {
|
||||
// process.env.KOA_ENV = process.env.KOA_ENV || 'dev'
|
||||
// console.log(`env: ${process.env.KOA_ENV}`)
|
||||
|
||||
const FILENAME = `../config/system-user-${config.env}.json`
|
||||
const FILENAME = `../../config/system-user-${config.env}.json`
|
||||
const adminUserData = require(FILENAME)
|
||||
// console.log(`adminUserData: ${JSON.stringify(adminUserData, null, 2)}`)
|
||||
|
||||
Reference in New Issue
Block a user