@wmfs/tymly-cardscript-plugin
Version:
Plugin which handles interactions to do with Cardscript
55 lines (44 loc) • 1.75 kB
JavaScript
/* eslint-env mocha */
const tymly = require('@wmfs/tymly')
const path = require('path')
const process = require('process')
const expect = require('chai').expect
const GET_USER_DASHBOARD_STATE_MACHINE = 'tymly_getUserDashboardData_1_0'
describe('user dashboard data tymly-cardscript-plugin tests', function () {
this.timeout(process.env.TIMEOUT || 5000)
let statebox, tymlyService
before(async () => {
if (process.env.PG_CONNECTION_STRING && !/^postgres:\/\/[^:]+:[^@]+@(?:localhost|127\.0\.0\.1).*$/.test(process.env.PG_CONNECTION_STRING)) {
console.log(`Skipping tests due to unsafe PG_CONNECTION_STRING value (${process.env.PG_CONNECTION_STRING})`)
return this.skip()
}
const tymlyServices = await tymly.boot({
pluginPaths: [
path.resolve(__dirname, './../lib'),
require.resolve('@wmfs/tymly-pg-plugin'),
require.resolve('@wmfs/tymly-solr-plugin'),
require.resolve('@wmfs/tymly-test-helpers/plugins/allow-everything-rbac-plugin')
]
})
statebox = tymlyServices.statebox
tymlyService = tymlyServices.tymly
})
it('get user dashboard data', async () => {
const executionDescription = await statebox.startExecution(
{},
GET_USER_DASHBOARD_STATE_MACHINE,
{
sendResponse: 'COMPLETE',
userId: 'test-user'
}
)
expect(executionDescription.currentStateName).to.eql('GetUserDashboardData')
expect(executionDescription.currentResource).to.eql('module:getUserDashboardData')
expect(executionDescription.stateMachineName).to.eql(GET_USER_DASHBOARD_STATE_MACHINE)
expect(executionDescription.status).to.eql('SUCCEEDED')
})
after(async () => {
await tymlyService.shutdown()
})
})