muddler
Version:
A minifier for hackmud scripts
39 lines (34 loc) • 920 B
text/typescript
import chai = require("chai")
const should = chai.should();
const fs = require('fs');
declare var muddled: Function;
const window = {};
const code = fs.readFileSync('examples/sample.temp.js', 'utf8').toString()
eval(code);
const log_box = [];
const $fs = {
scripts: {
lib: () => {
return {
log: x => log_box.push(x),
get_log: () => log_box
}
}
}
}
let db = []
const $db = {
i: (arg) => {
db.push(arg)
}
}
describe('Sample', () => {
describe('log', () => {
it('should add an item to the log', () => {
const res = muddled()
log_box.length.should.be.above(0)
log_box[0].should.equal('testing')
db[0]["SID"].should.equal('haxor')
})
})
})