← Back to Pull requests

added test suite for database #4

Open
datonedoe opened this pull request with 4702 lines diff across 4 files
View on GitHub
datonedoe datonedoe commented on Jun 07, 2018 04:08 UTC
Author

No description provided by author.

Diff: 4702 lines (+4517 / -185) across 4 files Reviewer: smrutherford Review duration: 4468084m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.60) × (1 − Review Confidence (0.73)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.60 · 4702 lines diff across 4 files
0.60
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.58 · 4 substantive comment(s)
0.58
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
72%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.400
Empty Description empty_description
0.060
Real PR Conversation Timeline
6 items
smrutherford smrutherford commented on code on Jun 07, 2018 18:47 UTC
Code Review
.eslintrc.js:1
@@ -3,6 +3,9 @@ module.exports = {
   rules: {
     'no-console': 'off',
     'no-underscore-dangle': ['error', { allow: ['_id'] }],
-    'no-plusplus': 'off'
+    'no-plusplus': 'off',

You might want to keep this rule so that everyone's code is consistent.

smrutherford smrutherford commented on code on Jun 07, 2018 18:48 UTC
Code Review
package.json:1
@@ -23,6 +24,7 @@
     "eslint-config-hackreactor": "git://github.com/reactorcore/eslint-config-hackreactor",

I think you can uninstall HR's linter since we're using the airbnb linter. Also, don't forget to update your STYLE-GUIDE.md to refer to the airbnb linter.

smrutherford smrutherford commented on code on Jun 07, 2018 18:52 UTC
Code Review
testing/database.test.js:1
@@ -0,0 +1,64 @@
+const mongoose = require('mongoose');
+const { MONGO_URI } = require('../config');
+const Hostel = require('../dataseeding/Schema/Hostel');
+const User = require('../dataseeding/Schema/User');
+const Review = require('../dataseeding/Schema/Review');
+
+let db;
+beforeAll(async () => {
+  db = await mongoose.connect(MONGO_URI);
+});
+
+describe('Database collection', () => {
+  describe('Database connection', () => {
+    test('mLab database server connected', () => {
+      expect(db).toBeTruthy();
+    });
+  });
+
+  describe('Data checking', () => {
+    describe('Hostel collection', () => {
+      test('should exist at least one hostel record', async () => {
+        const hostelRecord = await Hostel.findOne({});
+        expect(hostelRecord._id).toBeTruthy();
+      });
+      test('each hostel record should have a name field', async () => {

I think it's best to remain consistent with test names. For example, update this to read 'should have a name field for each hostel'.

smrutherford smrutherford requested changes on Jun 07, 2018 18:55 UTC
Changes Requested Reviewer

Overall, looks good! Good job on testing coverage. My only reservation is that you update your test names to be consistent. See my specific comment on one of your test names.

enague enague commented on code on Jun 08, 2018 17:21 UTC
Code Review
testing/database.test.js:1
@@ -0,0 +1,64 @@
+const mongoose = require('mongoose');
+const { MONGO_URI } = require('../config');
+const Hostel = require('../dataseeding/Schema/Hostel');
+const User = require('../dataseeding/Schema/User');
+const Review = require('../dataseeding/Schema/Review');
+
+let db;
+beforeAll(async () => {
+  db = await mongoose.connect(MONGO_URI);
+});
+
+describe('Database collection', () => {
+  describe('Database connection', () => {
+    test('mLab database server connected', () => {
+      expect(db).toBeTruthy();
+    });
+  });
+
+  describe('Data checking', () => {
+    describe('Hostel collection', () => {
+      test('should exist at least one hostel record', async () => {
+        const hostelRecord = await Hostel.findOne({});
+        expect(hostelRecord._id).toBeTruthy();
+      });
+      test('each hostel record should have a name field', async () => {

yeah i agree with that

Reviewers
Assignees
datonedoe datonedoe
Labels
risk: low confidence: 72.6% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 60.4% (MEDIUM) · Higher = larger blast radius
60.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 72.6% · Lower = rushed or shallow review
72.6%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.6% · Safe to merge
16.6%
Repository