Your IP : 216.73.216.220


Current Path : /proc/thread-self/root/home/deltalab/PMS/partner-manager-backend/test/
Upload File :
Current File : //proc/thread-self/root/home/deltalab/PMS/partner-manager-backend/test/warehouse.test.js

/**
 * This is a simple test example.
 * 
 * You can use this as a template for other examples
 */

// DEPENDENCIES ====================================
const { expect, assert } = require('chai');
const mongoose = require('mongoose');
const { dotenv } = require('dotenv').config();
// RESOURCES =======================================
const ims                       = require ('../services/ims');
const { warehouseModel}         = require ("../models/mongoose/warehouse");
const { warehouseJournalModel}  = require ("../models/mongoose/warehouse-journal");
// TEST CASES ======================================
describe('warehouse', () => {

  // Initialization --------------------------------
  before((done) => {
    mongoose.connect(process.env.database_url);
    const db = mongoose.connection;
    db.on('error', console.error.bind(console, 'connection error'));
    db.once('open', function () {
      console.log('We are connected to test database!');
      done();
    });
  });

  it('create warehouse journal entry', async () => {
    const journalEntry               = new warehouseJournalModel();
    journalEntry.date                = new Date();
    journalEntry.warehouseId         = '615369c11200097db30d2004';
    journalEntry.productId           = '62178bd7fb8a7981f382ca1b';
    journalEntry.partnerId           = '6125199597b1612d8071eafd'
    journalEntry.variation           = '5';
    journalEntry.totalQuantity       = '100';
    journalEntry.reason              = 'INCREASE';
    await journalEntry.save();
  });
});