mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(test) improved settings fixtures
This commit is contained in:
parent
7d83d6454f
commit
664e42099a
@ -16,7 +16,12 @@ type TDateISODate = `${TYear}-${TMonth}-${TDay}`;
|
|||||||
/**
|
/**
|
||||||
* Represent a string like `14:42:34.678`
|
* Represent a string like `14:42:34.678`
|
||||||
*/
|
*/
|
||||||
type TDateISOTime = `${THours}:${TMinutes}:${TSeconds}.${TMilliseconds}`;
|
type TDateISOTime = `${THours}:${TMinutes}:${TSeconds}`|`${THours}:${TMinutes}:${TSeconds}.${TMilliseconds}`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent a timezone like `+0100`
|
||||||
|
*/
|
||||||
|
type TTimezoneISO = `+${THours}${TMinutes}`|`-${THours}${TMinutes}`|'Z'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent a string like `2021-01-08T14:42:34.678Z` (format: ISO 8601).
|
* Represent a string like `2021-01-08T14:42:34.678Z` (format: ISO 8601).
|
||||||
@ -25,4 +30,4 @@ type TDateISOTime = `${THours}:${TMinutes}:${TSeconds}.${TMilliseconds}`;
|
|||||||
* it would result in a warning from TypeScript:
|
* it would result in a warning from TypeScript:
|
||||||
* "Expression produces a union type that is too complex to represent. ts(2590)
|
* "Expression produces a union type that is too complex to represent. ts(2590)
|
||||||
*/
|
*/
|
||||||
export type TDateISO = `${TDateISODate}T${TDateISOTime}Z`;
|
export type TDateISO = `${TDateISODate}T${TDateISOTime}${TTimezoneISO}`;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@ import groups from '../__fixtures__/groups';
|
|||||||
import plans from '../__fixtures__/plans';
|
import plans from '../__fixtures__/plans';
|
||||||
import planCategories from '../__fixtures__/plan_categories';
|
import planCategories from '../__fixtures__/plan_categories';
|
||||||
import { partners } from '../__fixtures__/users';
|
import { partners } from '../__fixtures__/users';
|
||||||
import { setting, settings } from '../__fixtures__/settings';
|
import { settings } from '../__fixtures__/settings';
|
||||||
|
|
||||||
const server = setupServer(
|
const server = setupServer(
|
||||||
rest.get('/api/groups', (req, res, ctx) => {
|
rest.get('/api/groups', (req, res, ctx) => {
|
||||||
@ -30,11 +30,11 @@ const server = setupServer(
|
|||||||
/* eslint-enable camelcase */
|
/* eslint-enable camelcase */
|
||||||
}),
|
}),
|
||||||
rest.get('/api/settings/:name', (req, res, ctx) => {
|
rest.get('/api/settings/:name', (req, res, ctx) => {
|
||||||
return res(ctx.json(setting(req.params.name, 'true')));
|
return res(ctx.json(settings.find(s => s.name === req.params.name)));
|
||||||
}),
|
}),
|
||||||
rest.get('/api/settings', (req, res, ctx) => {
|
rest.get('/api/settings', (req, res, ctx) => {
|
||||||
const { names } = req.params;
|
const { names } = req.params;
|
||||||
return res(ctx.json(settings(names.replace(/[[\]']/g, '').split(','))));
|
return res(ctx.json(settings.filter(name => names.replace(/[[\]']/g, '').split(',').includes(name))));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user