crowi.test.js 810 B

123456789101112131415161718192021222324252627
  1. const { getInstance } = require('../setup-crowi');
  2. describe('Test for Crowi application context', () => {
  3. describe('construction', () => {
  4. test('initialize crowi context', async() => {
  5. const crowi = await getInstance();
  6. expect(crowi.version).toBe(require('@root/package.json').version);
  7. expect(typeof crowi.env).toBe('object');
  8. });
  9. test('config getter, setter', async() => {
  10. const crowi = await getInstance();
  11. expect(crowi.getConfig()).toEqual({});
  12. crowi.setConfig({ test: 1 });
  13. expect(crowi.getConfig()).toEqual({ test: 1 });
  14. });
  15. test('model getter, setter', async() => {
  16. const crowi = await getInstance();
  17. // set
  18. crowi.model('hoge', { fuga: 1 });
  19. expect(crowi.model('hoge')).toEqual({ fuga: 1 });
  20. });
  21. });
  22. });