1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-26 20:54:21 +01:00
Sylvain 7d83d6454f (test) Jest + react-testing-library
This commit aims to put a testing environment in place
for frontend react components using the de-facto standards
for our stack.

An example test file was writter for the component plan-form.tsx.
Some fixtures for some API endpoints were written (see
__setup__/server.js)
2022-12-21 14:14:22 +01:00

20 lines
551 B
TypeScript

import { Setting } from '../../../app/frontend/src/javascript/models/setting';
import { TDateISO } from '../../../app/frontend/src/javascript/typings/date-iso';
export const setting = (name, value): Setting => {
return {
last_update: new Date().toISOString() as TDateISO,
localized: name[0].toUpperCase() + name.substring(1),
name,
value: value.toString()
};
};
export const settings = (names: Array<string>): Record<string, string> => {
const res = {};
names.forEach(name => {
res[name] = 'true';
});
return res;
};