How to use the actionhero.Process function in actionhero

To help you get started, we’ve selected a few actionhero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github actionhero / actionhero-tutorial / test / example.js View on Github external
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)

const ActionHero = require('actionhero')
const actionhero = new ActionHero.Process()
let api

describe('actionhero Tests', () => {
  before(async () => { api = await actionhero.start() })
  after(async () => { await actionhero.stop() })

  it('should have booted into the test env', () => {
    expect(process.env.NODE_ENV).to.equal('test')
    expect(api.env).to.equal('test')
    expect(api.id).to.be.ok()
  })

  it('can retrieve server uptime via the status action', async () => {
    let {uptime} = await api.specHelper.runAction('status')
    expect(uptime).to.be.above(0)
  })
github actionhero / actionhero-tutorial / __tests__ / example.js View on Github external
'use strict'

const ActionHero = require('actionhero')
const actionhero = new ActionHero.Process()
let api

describe('actionhero Tests', () => {
  beforeAll(async () => { api = await actionhero.start() })
  afterAll(async () => { await actionhero.stop() })

  test('should have booted into the test env', () => {
    expect(process.env.NODE_ENV).toEqual('test')
    expect(api.env).toEqual('test')
    expect(api.id).toBeTruthy()
  })

  test('can retrieve server uptime via the status action', async () => {
    const { uptime } = await api.specHelper.runAction('status')
    expect(uptime).toBeGreaterThan(0)
  })
github actionhero / actionhero-node-client / test / client.js View on Github external
const should = require('should')
const path = require('path')
const ActionheroNodeClient = require(path.join(__dirname, '/../lib/client.js'))
const { Process } = require('actionhero')

const port = 9000
process.chdir(path.join(__dirname, '..', 'node_modules', 'actionhero'))
process.env.ACTIONHERO_CONFIG = path.join(__dirname, '..', 'node_modules', 'actionhero', 'config')

const actionhero = new Process()

const serverConfig = {
  general: {
    id: 'test-server-1',
    workers: 0,
    developmentMode: false,
    startingChatRooms: {
      defaultRoom: {},
      otherRoom: {}
    }
  },
  servers: {
    web: { enabled: false },
    websocket: { enabled: false },
    socket: {
      enabled: true,
github actionhero / actionhero-tutorial / __tests__ / integration / users.js View on Github external
const request = require('request-promise-native')
const ActionHero = require('actionhero')
const actionhero = new ActionHero.Process()
let api
let url

describe('integration', () => {
  beforeAll(async () => {
    api = await actionhero.start()
    url = `http://localhost:${api.config.servers.web.port}/api`
  })

  beforeAll(async () => {
    try {
      await request.del(`${url}/user/evan`, { body: { password: 'password' }, json: true })
    } catch (error) {
      if (error.statusCode !== 400) { throw error }
    }
github actionhero / actionhero-tutorial / __tests__ / integration / posts.js View on Github external
const request = require('request-promise-native')
const ActionHero = require('actionhero')
const actionhero = new ActionHero.Process()
let api
let url

describe('integration', () => {
  describe('posts', () => {
    beforeAll(async () => {
      api = await actionhero.start()
      url = `http://localhost:${api.config.servers.web.port}/api`
    })

    beforeAll(async () => {
      try {
        await request.del(`${url}/user/testPoster`, { body: { password: 'password' }, json: true })
      } catch (error) {
        if (error.statusCode !== 400) { throw error }
      }