<commit_before>"use strict";
var _getSert = require("../getsert");
var generateCode = require("../../../src/utils/code-generator");
var unit = require("./unit-data-util");

class StorageDataUtil {
    getSert(input) {
        var ManagerType = require("../../../src/managers/master/storage-manager");
        return _getSert(input, ManagerType, (data) => {
            return {
                code: data.code
            };
        });
    }

    getNewData() {
        return Promise.all([unit.getTestData()])
            .then((results) => {
                var _unit= results[0];
                var Model = require('dl-models').master.Storage;

                var code = generateCode();
                
                var data ={
                    code : code,
                    name : `name[${code}]`,
                    description : `storage description [${code}]`,
                    unit:_unit,
                    unitId:_unit._id
                }

                return Promise.resolve(data);
            });
    }

    getRandomTestData() {
        return this.getNewData()
            .then((data) => {
                return this.getSert(data);
            });
    }

    getTestData() {
         return unit.getTestData()
            .then((data) => {
                data.code = "Storage-UT-01";
                data.name = "Storage Unit Test 01";
                data.unitId=data._id;
                data.unit=data;
                data.description = "Product untuk unit test";

                return this.getSert(data);
            });
    }

    getPackingTestData() {
        return unit.getTestData()
            .then((data) => {
                data = {
                    code: 'UT/GudangJadi01',
                    name: '<NAME> Finishing Printing01',
                    description: '',
                    unitId:data._id,
                    unit:data
                };
                return this.getSert(data);
         });
    }

    getTextileInventoryTestData() {
        return unit.getTestData()
            .then((data) => {
                var data = {
                    code: 'UT/GudangTextile01',
                    name: 'Gudang Pembelian Textile',
                    description: '',
                    unitId:data._id,
                    unit:data
                };
                return this.getSert(data);
            });
    }
}<commit_msg>fix storage data util<commit_after>"use strict";
var _getSert = require("../getsert");
var generateCode = require("../../../src/utils/code-generator");
var unit = require("./unit-data-util");

class StorageDataUtil {
    getSert(input) {
        var ManagerType = require("../../../src/managers/master/storage-manager");
        return _getSert(input, ManagerType, (data) => {
            return {
                code: data.code
            };
        });
    }

    getNewData() {
        return Promise.all([unit.getTestData()])
            .then((results) => {
                var _unit= results[0];
                var Model = require('dl-models').master.Storage;

                var code = generateCode();
                
                var data ={
                    code : code,
                    name : `name[${code}]`,
                    description : `storage description [${code}]`,
                    unit:_unit,
                    unitId:_unit._id
                }

                return Promise.resolve(data);
            });
    }

    getRandomTestData() {
        return this.getNewData()
            .then((data) => {
                return this.getSert(data);
            });
    }

    getTestData() {
         return unit.getTestData()
            .then((data) => {
                data.code = "Storage-UT-01";
                data.name = "Storage Unit Test 01";
                data.unitId=data._id;
                data.unit=data;
                data.description = "Product untuk unit test";

                return this.getSert(data);
            });
    }

    getPackingTestData() {
        return unit.getTestData()
            .then((data) => {
                data = {
                    code: 'UT/GudangJadi01',
                    name: '<NAME>adi Finishing Printing',
                    description: '',
                    unitId:data._id,
                    unit:data
                };
                return this.getSert(data);
         });
    }

    getTextileInventoryTestData() {
        return unit.getTestData()
            .then((data) => {
                var data = {
                    code: 'UT/GudangTextile01',
                    name: 'Gudang Pembelian Textile',
                    description: '',
                    unitId:data._id,
                    unit:data
                };
                return this.getSert(data);
            });
    }
}
{'fraction_non_alphanumeric': 0.12668184640861105, 'fraction_numerical': 0.004139929621196439, 'mean_word_length': 1.1342756183745584, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4764846', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1212, 'n_words': 223}