Skip to content

Commit

Permalink
test: fix EncryptedData tests
Browse files Browse the repository at this point in the history
Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
  • Loading branch information
achrinza committed Sep 12, 2021
1 parent af6500b commit 34f824b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/postgresql.encrypted.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ describe('Mapping models', function() {
it('should return encrypted data by filter', function(done) {
const schema =
{
'name': 'EncryptedData',
'name': 'EncryptedDataFilter',
'options': {
'idInjection': false,
'postgresql': {
'schema': 'public', 'table': 'encrypted_data',
'schema': 'public', 'table': 'encrypted_data_filter',
},
},
'properties': {
Expand All @@ -47,26 +47,26 @@ describe('Mapping models', function() {
},
};

const EncryptedData = db.createModel(schema.name, schema.properties, schema.options);
EncryptedData.settings.mixins = schema.mixins;
const EncryptedDataFilter = db.createModel(schema.name, schema.properties, schema.options);
EncryptedDataFilter.settings.mixins = schema.mixins;

db.automigrate('EncryptedData', function(err) {
db.automigrate('EncryptedDataFilter', function(err) {
if (err) console.error({err});
EncryptedData.create({
EncryptedDataFilter.create({
id: '2',
data: '1c93722e6cf53f93dd4eb15a18444dc3e910fded18239db612794059af1fa5e8',
}, function(err, encryptedData) {
if (err) console.log({err2: err});
async.series([
function(callback) {
EncryptedData.findOne({where: {data: {ilike: '%test%'}}}, function(err, retreivedData) {
EncryptedDataFilter.findOne({where: {data: {ilike: '%test%'}}}, function(err, retreivedData) {
if (err) console.error({err111: err});
expect(retreivedData).to.containSubset(encryptedData);
callback(null, retreivedData);
});
},
function(callback) {
EncryptedData.find({where: {data: {ilike: '%not found%'}}}, function(err, retreivedData) {
EncryptedDataFilter.find({where: {data: {ilike: '%not found%'}}}, function(err, retreivedData) {
if (err) console.error({err111: err});
expect(retreivedData.length).to.equal(0);
callback(null, retreivedData);
Expand Down

0 comments on commit 34f824b

Please sign in to comment.