mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-28 05:59:42 -08:00
5887ed6498
Co-authored-by: Ricardo Espinoza <ricardo@n8n.io>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { User } from '@db/entities/User';
|
|
|
|
describe('User Entity', () => {
|
|
describe('JSON.stringify', () => {
|
|
it('should not serialize sensitive data', () => {
|
|
const user = Object.assign(new User(), {
|
|
email: 'test@example.com',
|
|
firstName: 'Don',
|
|
lastName: 'Joe',
|
|
password: '123456789',
|
|
apiKey: '123',
|
|
});
|
|
expect(JSON.stringify(user)).toEqual(
|
|
'{"email":"test@example.com","firstName":"Don","lastName":"Joe"}',
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('createPersonalProjectName', () => {
|
|
test.each([
|
|
['Nathan', 'Nathaniel', 'nathan@nathaniel.n8n', 'Nathan Nathaniel <nathan@nathaniel.n8n>'],
|
|
[undefined, 'Nathaniel', 'nathan@nathaniel.n8n', '<nathan@nathaniel.n8n>'],
|
|
['Nathan', undefined, 'nathan@nathaniel.n8n', '<nathan@nathaniel.n8n>'],
|
|
[undefined, undefined, 'nathan@nathaniel.n8n', '<nathan@nathaniel.n8n>'],
|
|
[undefined, undefined, undefined, 'Unnamed Project'],
|
|
['Nathan', 'Nathaniel', undefined, 'Unnamed Project'],
|
|
])(
|
|
'given fistName: %s, lastName: %s and email: %s this gives the projectName: "%s"',
|
|
async (firstName, lastName, email, projectName) => {
|
|
const user = new User();
|
|
Object.assign(user, { firstName, lastName, email });
|
|
expect(user.createPersonalProjectName()).toBe(projectName);
|
|
},
|
|
);
|
|
});
|
|
});
|