Skip to content

Commit

Permalink
Feat(tenant): Update enrichment test for update
Browse files Browse the repository at this point in the history
  • Loading branch information
arimet committed Oct 23, 2023
1 parent 8e7caa5 commit d748421
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 8 deletions.
1 change: 1 addition & 0 deletions cypress/e2e/phase_2/enrichment.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('Enrichment', () => {
enrichmentFormPage.openEnrichment();
cy.wait(300);
enrichmentFormPage.fillAdvancedEnrichment();
enrichmentFormPage.updateNameEnrichment();
enrichmentFormPage.runEnrichment();
adminNavigation.goToData();
cy.wait(300);
Expand Down
13 changes: 13 additions & 0 deletions cypress/support/enrichmentFormPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ bySecond = 1
cy.wait(6000);
};

export const updateNameEnrichment = () => {
cy.get('input[name="name"]', { timeout: 500 }).clear();
cy.get('input[name="name"]', { timeout: 500 }).type('Enrichment');
cy.contains('Save', { timeout: 500 }).click({
force: true,
});
cy.reload();
cy.get('input[name="name"]', { timeout: 3500 }).should(
'have.value',
'Enrichment',
);
};

export const runEnrichment = () => {
cy.contains('Run', { timeout: 6000 }).click({
force: true,
Expand Down
7 changes: 4 additions & 3 deletions src/api/controller/api/login.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { auth } from 'config';
import jwt from 'jsonwebtoken';

import { postLogin as login } from './login';
import { ADMIN_ROLE } from '../../../common/tools/tenantTools';

const expDate = Date.now();

Expand Down Expand Up @@ -66,19 +67,19 @@ describe('login', () => {
token: jwt.sign(
{
username: 'user',
role: 'admin',
role: ADMIN_ROLE,
exp: Math.ceil(expDate / 1000) + auth.expiresIn,
},
auth.headerSecret,
),
role: 'admin',
role: ADMIN_ROLE,
});
expect(setCall).toEqual([
'lodex_token_test',
jwt.sign(
{
username: 'user',
role: 'admin',
role: ADMIN_ROLE,
exp: Math.ceil(expDate / 1000) + auth.expiresIn,
},
auth.cookieSecret,
Expand Down
4 changes: 3 additions & 1 deletion src/api/models/enrichment.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export default async db => {
{
$or: [{ _id: objectId }, { _id: id }],
},
omit(data, ['_id']),
{
$set: omit(data, ['_id']),
},
{
returnOriginal: false,
},
Expand Down
2 changes: 1 addition & 1 deletion src/api/models/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export default async db => {
{
_id: new ObjectId(uf._id),
},
uf,
{ $set: uf },
),
),
);
Expand Down
4 changes: 3 additions & 1 deletion src/api/models/precomputed.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export default async db => {
{
$or: [{ _id: objectId }, { _id: id }],
},
omit(data, ['_id']),
{
$set: omit(data, ['_id']),
},
{
returnOriginal: false,
},
Expand Down
4 changes: 3 additions & 1 deletion src/api/models/subresource.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export default async db => {
{
_id: objectId,
},
omit(data, ['_id']),
{
$set: omit(data, ['_id']),
},
{
returnOriginal: false,
},
Expand Down
4 changes: 3 additions & 1 deletion src/api/models/tenant.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export default async db => {
{
$or: [{ _id: objectId }, { _id: id }],
},
omit(data, ['_id']),
{
$set: omit(data, ['_id']),
},
{
returnOriginal: false,
},
Expand Down

0 comments on commit d748421

Please sign in to comment.