mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Add basic tests about Koa core and middlewares
This commit is contained in:
parent
5a580dd6d1
commit
6df354d809
33
packages/strapi/test/application.js
Executable file
33
packages/strapi/test/application.js
Executable file
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
const strapi = require('../lib/');
|
||||
|
||||
/**
|
||||
* No need to test everything about Koa.
|
||||
* We just need need to make sure that everything
|
||||
* is correctly required and loaded inside `strapi`.
|
||||
*/
|
||||
|
||||
describe('application', function () {
|
||||
it('`strapi.app` should be an object', function () {
|
||||
assert(typeof strapi.app === 'object');
|
||||
});
|
||||
|
||||
it('`strapi.app.use` should be a function', function () {
|
||||
assert(typeof strapi.app.use === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.app.context` should be an object', function () {
|
||||
assert(typeof strapi.app.context === 'object');
|
||||
});
|
||||
|
||||
it('`strapi.app.request` should be an object', function () {
|
||||
assert(typeof strapi.app.request === 'object');
|
||||
});
|
||||
|
||||
it('`strapi.app.response` should be an object', function () {
|
||||
assert(typeof strapi.app.response === 'object');
|
||||
});
|
||||
});
|
||||
48
packages/strapi/test/core.js
Executable file
48
packages/strapi/test/core.js
Executable file
@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
const strapi = require('../lib/');
|
||||
|
||||
/**
|
||||
* Make sure private functions are correctly
|
||||
* required and loaded.
|
||||
*/
|
||||
|
||||
describe('core', function () {
|
||||
it('`strapi` should be an object', function () {
|
||||
assert(typeof strapi === 'object');
|
||||
});
|
||||
|
||||
it('`strapi.load` should be a function', function () {
|
||||
assert(typeof strapi.load === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.initialize` should be a function', function () {
|
||||
assert(typeof strapi.initialize === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.exposeGlobals` should be a function', function () {
|
||||
assert(typeof strapi.exposeGlobals === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.isLocalStrapiValid` should be a function', function () {
|
||||
assert(typeof strapi.isLocalStrapiValid === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.isStrapiAppSync` should be a function', function () {
|
||||
assert(typeof strapi.isStrapiAppSync === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.runBootstrap` should be a function', function () {
|
||||
assert(typeof strapi.runBootstrap === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.start` should be a function', function () {
|
||||
assert(typeof strapi.start === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.stop` should be a function', function () {
|
||||
assert(typeof strapi.stop === 'function');
|
||||
});
|
||||
});
|
||||
31
packages/strapi/test/logger.js
Executable file
31
packages/strapi/test/logger.js
Executable file
@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
const strapi = require('../lib/');
|
||||
|
||||
/**
|
||||
* Make sure the logger works correctly.
|
||||
*/
|
||||
|
||||
describe('logger', function () {
|
||||
it('`strapi.log` should be an object', function () {
|
||||
assert(typeof strapi.log === 'object');
|
||||
});
|
||||
|
||||
it('`strapi.log.verbose` should be a function', function () {
|
||||
assert(typeof strapi.log.verbose === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.log.info` should be a function', function () {
|
||||
assert(typeof strapi.log.info === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.log.warn` should be a function', function () {
|
||||
assert(typeof strapi.log.warn === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.log.error` should be a function', function () {
|
||||
assert(typeof strapi.log.error === 'function');
|
||||
});
|
||||
});
|
||||
89
packages/strapi/test/middlewares.js
Executable file
89
packages/strapi/test/middlewares.js
Executable file
@ -0,0 +1,89 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
const strapi = require('../lib/');
|
||||
|
||||
/**
|
||||
* No need to test everything about Koa middlewares.
|
||||
* We just need need to make sure that they all are
|
||||
* correctly required and loaded inside `strapi`.
|
||||
*/
|
||||
|
||||
describe('middlewares', function () {
|
||||
it('`strapi.middlewares` should be an object', function () {
|
||||
assert(typeof strapi.middlewares === 'object');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.bodyparser` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.bodyparser === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.compose` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.compose === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.compress` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.compress === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.cors` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.cors === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.favicon` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.favicon === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.graphql` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.graphql === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.i18n` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.i18n === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.ip` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.ip === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.locale` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.locale === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.lusca` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.lusca === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.mount` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.mount === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.proxy` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.proxy === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.responseTime` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.responseTime === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.router` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.router === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.send` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.send === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.session` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.session === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.static` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.static === 'function');
|
||||
});
|
||||
|
||||
it('`strapi.middlewares.views` should be a function', function () {
|
||||
assert(typeof strapi.middlewares.views === 'function');
|
||||
});
|
||||
});
|
||||
@ -1 +0,0 @@
|
||||
--reporter dot --ui tdd --timeout 10000
|
||||
Loading…
x
Reference in New Issue
Block a user