| 1234567891011121314151617181920212223242526272829 |
- import packageJson from '^/package.json';
- const { getInstance } = require('../setup-crowi');
- describe('Test for Crowi application context', () => {
- describe('construction', () => {
- test('initialize crowi context', async() => {
- const crowi = await getInstance();
- expect(crowi.version).toBe(packageJson.version);
- expect(typeof crowi.env).toBe('object');
- });
- test('config getter, setter', async() => {
- const crowi = await getInstance();
- expect(crowi.getConfig()).toEqual({});
- crowi.setConfig({ test: 1 });
- expect(crowi.getConfig()).toEqual({ test: 1 });
- });
- test('model getter, setter', async() => {
- const crowi = await getInstance();
- // set
- crowi.model('hoge', { fuga: 1 });
- expect(crowi.model('hoge')).toEqual({ fuga: 1 });
- });
- });
- });
|