pagaris
Version:
Pagaris API client for Node
52 lines (47 loc) • 1.26 kB
JavaScript
require('dotenv').config()
const assert = require('assert')
const { Polly, setupMocha } = require('@pollyjs/core')
const setupPolly = setupMocha
const NodeHttpAdapter = require('@pollyjs/adapter-node-http')
const FSPersister = require('@pollyjs/persister-fs')
Polly.register(NodeHttpAdapter)
Polly.register(FSPersister)
const Client = require('../lib/client')
const { Pagaris, Order, Signature, Errors } = require('../index')
before(function () {
/**
* If there are requests on the current test, PollyJS will record them
* automatically.
*/
setupPolly({
mode: 'replay',
recordIfMissing: process.env.POLLY_RECORD == 'true',
adapters: ['node-http'],
persister: ['fs'],
persisterOptions: {
fs: {
recordingsDir: 'test/recordings'
}
},
matchRequestsBy: {
headers: false // Since Authorization header will change every time
},
recordFailedRequests: true
})
})
beforeEach(function () {
/**
* Configure Pagaris. If a test needs to overwrite it, it can just do it, but
* this is the default.
*/
Pagaris.applicationId = process.env.APPLICATION_ID
Pagaris.privateKey = process.env.PRIVATE_KEY
})
module.exports = {
Pagaris,
Client,
Errors,
Signature,
Order,
assert
}