Last active
April 15, 2020 18:02
-
-
Save chimmelb/2c4aceef2ce378b20051901732642624 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is the test file that is run by Jest. | |
* It has the (single) setup for the actionhero instance | |
*/ | |
import { Process, env, id, specHelper } from 'actionhero' | |
import createTests from './lib/create' | |
import updateTests from './lib/update' | |
const actionhero = new Process() | |
let api | |
describe('SmartLoad Templates', () => { | |
beforeAll(async () => { | |
await actionhero.start() | |
}) | |
afterAll(async () => { | |
await actionhero.stop() | |
}) | |
describe('Create', createTests) | |
describe('Update', updateTests) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* group of tests just for create | |
*/ | |
import { Process, env, id, specHelper, api } from 'actionhero' | |
export default () => { | |
let globalTemplateId: number | |
test('global template can be created', async () => { | |
const { template, error } = await specHelper.runAction('createTemplate', { | |
type: 'GlobalTemplate', | |
template: { name: 'K12Template' }, | |
}) | |
expect(error).toBeUndefined() | |
expect(template).toBeTruthy() | |
expect(template.id).toBeTruthy() | |
globalTemplateId = template.id | |
}) | |
test('global template will error with the same name', async () => { | |
const { template, error } = await specHelper.runAction('createTemplate', { | |
type: 'GlobalTemplate', | |
template: { | |
name: 'K12Template', | |
}, | |
}) | |
expect(error).toContain('GlobalTemplate with that name already exists') | |
expect(template).toBeUndefined() | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment