Skip to content

Commit

Permalink
Fix more type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rylnd committed Aug 2, 2021
1 parent 93aa2db commit e2f31cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ export default ({ getService }: FtrProviderContext): void => {
const signals = await getSignalsByIds(supertest, [id]);

const alert = signals.hits.hits[0];
expect(alert._source.signal.status).eql('open');
expect(alert._source?.signal.status).eql('open');

const caseUpdated = await createComment({
supertest,
Expand Down Expand Up @@ -846,7 +846,7 @@ export default ({ getService }: FtrProviderContext): void => {
.send(getQuerySignalIds([alert._id]))
.expect(200);

expect(updatedAlert.hits.hits[0]._source.signal.status).eql('in-progress');
expect(updatedAlert.hits.hits[0]._source?.signal.status).eql('in-progress');
});

it('does NOT updates alert status when the status is updated and syncAlerts=false', async () => {
Expand All @@ -863,7 +863,7 @@ export default ({ getService }: FtrProviderContext): void => {
const signals = await getSignalsByIds(supertest, [id]);

const alert = signals.hits.hits[0];
expect(alert._source.signal.status).eql('open');
expect(alert._source?.signal.status).eql('open');

const caseUpdated = await createComment({
supertest,
Expand Down Expand Up @@ -899,7 +899,7 @@ export default ({ getService }: FtrProviderContext): void => {
.send(getQuerySignalIds([alert._id]))
.expect(200);

expect(updatedAlert.hits.hits[0]._source.signal.status).eql('open');
expect(updatedAlert.hits.hits[0]._source?.signal.status).eql('open');
});

it('it updates alert status when syncAlerts is turned on', async () => {
Expand All @@ -916,7 +916,7 @@ export default ({ getService }: FtrProviderContext): void => {
const signals = await getSignalsByIds(supertest, [id]);

const alert = signals.hits.hits[0];
expect(alert._source.signal.status).eql('open');
expect(alert._source?.signal.status).eql('open');

const caseUpdated = await createComment({
supertest,
Expand Down Expand Up @@ -970,7 +970,7 @@ export default ({ getService }: FtrProviderContext): void => {
.send(getQuerySignalIds([alert._id]))
.expect(200);

expect(updatedAlert.hits.hits[0]._source.signal.status).eql('in-progress');
expect(updatedAlert.hits.hits[0]._source?.signal.status).eql('in-progress');
});

it('it does NOT updates alert status when syncAlerts is turned off', async () => {
Expand All @@ -983,7 +983,7 @@ export default ({ getService }: FtrProviderContext): void => {
const signals = await getSignalsByIds(supertest, [id]);

const alert = signals.hits.hits[0];
expect(alert._source.signal.status).eql('open');
expect(alert._source?.signal.status).eql('open');

const caseUpdated = await createComment({
supertest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export default ({ getService }: FtrProviderContext): void => {
const signals = await getSignalsByIds(supertest, [id]);

const alert = signals.hits.hits[0];
expect(alert._source.signal.status).eql('open');
expect(alert._source?.signal.status).eql('open');

await createComment({
supertest,
Expand Down Expand Up @@ -424,7 +424,7 @@ export default ({ getService }: FtrProviderContext): void => {
const signals = await getSignalsByIds(supertest, [id]);

const alert = signals.hits.hits[0];
expect(alert._source.signal.status).eql('open');
expect(alert._source?.signal.status).eql('open');

await createComment({
supertest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ export default ({ getService }: FtrProviderContext) => {
const signalsOpen = await getOpenSignals(supertest, es, createdRule);
expect(signalsOpen.hits.hits.length).eql(1);
const signal = signalsOpen.hits.hits[0];
if (!signal._source) {
return expect(signal._source).to.be.ok();
}

expect(signal._source).eql({
'@timestamp': signal._source['@timestamp'],
actual: [1],
Expand Down

0 comments on commit e2f31cb

Please sign in to comment.