<commit_before>var fs = require('fs'),
    path = require('path'),
    _path = __dirname
        .replace(/\\/g, '/')
        .replace(/\/$/, ''),
    _testPath = _path+"/release";

var fis = require('../../fis-kernel.js');
var release = fis.release,
    config = fis.config,
    project = fis.project;

var expect = require('chai').expect;

describe('release',function(){
    before(function(){
        config.init();
    });

    /*
    * 结果打包
    * */
    it('pack = true & map &domain',function(done){
        var opt = {
            afterEach:function(file){
                files.push(file.origin);
                if(file.ext == ".js"){
                    expect(file.domain).to.equal("http://img.baidu.com");
                }else if(file.ext == ".css"){
                    expect(file.domain).to.equal("http://css.baidu.com");
                }
            },
            pack:true
        },files=[],expectFiles;
        expectFiles =
            [ _testPath+'/test1/index.css',
                _testPath+'/test1/index.js',
                _testPath+'/test1/index.tpl',
                _testPath+'/test1/npm.png',
                _testPath+'/test1/plugin/FISResource.class.php',
                _testPath+'/test1/plugin/compiler.body.php',
                _testPath+'/test1/plugin/compiler.head.php',
                _testPath+'/test1/plugin/compiler.html.php',
                _testPath+'/test1/plugin/compiler.require.php',
                _testPath+'/test1/plugin/compiler.script.php',
                _testPath+'/test1/plugin/compiler.widget.php',
                _testPath+'/test1/sea.js',
                _testPath+'/test1/widget/comp/comp.js',
                _testPath+'/test1/widget/list/list.css',
                _testPath+'/test1/widget/list/list.js',
                _testPath+'/test1/widget/list/list.tpl' ];
        fis.project.setProjectRoot(_testPath+"/test1");
        var conf = _testPath+"/test1/fis-conf.js";
        fis.config.merge(fis.util.readJSON(_testPath + '/standard.json'));
        require(conf);

        release(opt,function(ret){
            /*
             *打包的文件存在
             * */
             expect(ret.pkg["__p0__.js"].url).to.equal("/static/aio.js");
             //包的内容正确
             expect(ret.map.pkg.p0.has).to.deep.equal([ 'photo:widget/comp/comp.js', 'photo:widget/list/list.js' ]);
             //依赖正确
             expect(ret.map.pkg.p0.deps).to.deep.equal(['photo:widget/list/list.css']);

             /*
              * 普通文件 打包文件 map文件内容测试
              * */

            fs.readFile(_testPath+"/expect1/photo-map.json","utf-8",function(err,data){
                expect(ret.pkg["/photo-map.json"]._content).to.equal(data);
                fs.readFile(_testPath+"/expect1/__p0__.js","utf-8",function(err,data1){
//                    expect(ret.pkg["__p0__.js"]._content).to.equal(data1);
                    expect(files).to.deep.equal(expectFiles);
                    done();
                });
            });

        });
    });

   /*
    * 依赖测试
    * */
    it('deps',function(){
        fis.project.setProjectRoot(_testPath+"/test2");
        var conf = _testPath+"/test2/fis-conf.js";
        fis.config.merge(fis.util.readJSON(_testPath + '/standard.json'));
        require(conf);
        var files = [];
        var opt = {
            afterEach:function(file){
                files.push(file.origin);
                if(file.ext == ".js"){
                    expect(file.domain).to.equal("http://img.baidu.com");
                }else if(file.ext == ".css"){
                    expect(file.domain).to.equal("http://css.baidu.com");<commit_msg>modify relese ut case<commit_after>var fs = require('fs'),
    path = require('path'),
    _path = __dirname
        .replace(/\\/g, '/')
        .replace(/\/$/, ''),
    _testPath = _path+"/release";

var fis = require('../../fis-kernel.js');
var release = fis.release,
    config = fis.config,
    project = fis.project;

var expect = require('chai').expect;

describe('release',function(){
    before(function(){
        config.init();
    });

    /*
    * 结果打包
    * */
    it('pack = true & map &domain',function(done){
        var opt = {
            afterEach:function(file){
                files.push(file.origin);
                if(file.ext == ".js"){
                    expect(file.domain).to.equal("http://img.baidu.com");
                }else if(file.ext == ".css"){
                    expect(file.domain).to.equal("http://css.baidu.com");
                }
            },
            pack:true
        },files=[],expectFiles;
        expectFiles =
            [ _testPath+'/test1/index.css',
                _testPath+'/test1/index.js',
                _testPath+'/test1/index.tpl',
                _testPath+'/test1/npm.png',
                _testPath+'/test1/plugin/FISResource.class.php',
                _testPath+'/test1/plugin/compiler.body.php',
                _testPath+'/test1/plugin/compiler.head.php',
                _testPath+'/test1/plugin/compiler.html.php',
                _testPath+'/test1/plugin/compiler.require.php',
                _testPath+'/test1/plugin/compiler.script.php',
                _testPath+'/test1/plugin/compiler.widget.php',
                _testPath+'/test1/sea.js',
                _testPath+'/test1/widget/comp/comp.js',
                _testPath+'/test1/widget/list/list.css',
                _testPath+'/test1/widget/list/list.js',
                _testPath+'/test1/widget/list/list.tpl' ];
        fis.project.setProjectRoot(_testPath+"/test1");
        var conf = _testPath+"/test1/fis-conf.js";
        fis.config.merge(fis.util.readJSON(_testPath + '/standard.json'));
        require(conf);

        release(opt,function(ret){
            /*
             *打包的文件存在
             * */
             expect(ret.pkg["__p0__.js"].url).to.equal("/static/aio.js");
             //包的内容正确
             expect(ret.map.pkg.p0.has).to.deep.equal([ 'photo:widget/comp/comp.js', 'photo:widget/list/list.js' ]);
             //依赖正确
             expect(ret.map.pkg.p0.deps).to.deep.equal(['photo:widget/list/list.css']);

             /*
              * 普通文件 打包文件 map文件内容测试
              * */

            fs.readFile(_testPath+"/expect1/photo-map.json","utf-8",function(err,data){
                expect(ret.pkg["/photo-map.json"]._content).to.equal(data);
                fs.readFile(_testPath+"/expect1/__p0__.js","utf-8",function(err,data1){
//                    expect(ret.pkg["__p0__.js"]._content).to.equal(data1);
                    expect(files).to.deep.equal(expectFiles);
                    done();
                });
            });

        });
    });

   /*
    * 依赖测试
    * */
    it('deps',function(){
	    fis.config.del("roadmap.path");
        fis.project.setProjectRoot(_testPath+"/test2");
        var conf = _testPath+"/test2/fis-conf.js";
        fis.config.merge(fis.util.readJSON(_testPath + '/standard.json'));
        require(conf);
        var files = [];
        var opt = {
            afterEach:function(file){
                files.push(file.origin);
                if(file.ext == ".js"){
                    expect(file.domain).to.equal("http://img.baidu.com");
                }else if(file.ext == ".css"){
                    expect(file.domain).to.equal("http://css.baidu.com");
{'fraction_non_alphanumeric': 0.17678498012882007, 'fraction_numerical': 0.008496642455803755, 'mean_word_length': 1.637513552584026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7347713', 'n_tokens_mistral': 2369, 'n_tokens_neox': 2319, 'n_words': 221}