mirror of
https://github.com/strapi/strapi.git
synced 2025-07-26 10:29:59 +00:00
Add simple test for the password encryption
This commit is contained in:
parent
33611a9323
commit
c1ba9af7c0
@ -1,5 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
jest.mock('bcrypt', () => ({ hashSync: () => 'secret-password' }));
|
||||||
|
|
||||||
const { EventEmitter } = require('events');
|
const { EventEmitter } = require('events');
|
||||||
const createEntityService = require('../');
|
const createEntityService = require('../');
|
||||||
const entityValidator = require('../../entity-validator');
|
const entityValidator = require('../../entity-validator');
|
||||||
@ -109,6 +111,7 @@ describe('Entity service', () => {
|
|||||||
enum: ['a', 'b', 'c'],
|
enum: ['a', 'b', 'c'],
|
||||||
default: 'b',
|
default: 'b',
|
||||||
},
|
},
|
||||||
|
attrPassword: { type: 'password' },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -173,9 +176,13 @@ describe('Entity service', () => {
|
|||||||
attrIntDefault: 10,
|
attrIntDefault: 10,
|
||||||
attrEnumDefaultRequired: 'c',
|
attrEnumDefaultRequired: 'c',
|
||||||
attrEnumDefault: 'a',
|
attrEnumDefault: 'a',
|
||||||
|
attrPassword: 'fooBar',
|
||||||
};
|
};
|
||||||
|
|
||||||
await expect(instance.create('test-model', { data })).resolves.toMatchObject(data);
|
await expect(instance.create('test-model', { data })).resolves.toMatchObject({
|
||||||
|
...data,
|
||||||
|
attrPassword: 'secret-password',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user