crowi.test.js 835 B

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