migration: migrate NodeJS code base to Golang

This commit is contained in:
Mickael Kerjean
2018-07-30 13:34:44 +10:00
parent c5f2839fd7
commit 04c97e34fb
68 changed files with 3837 additions and 2217 deletions
+5
View File
@@ -0,0 +1,5 @@
describe('Helpers::event', () => {
it('test', () => {
});
});
+20
View File
@@ -0,0 +1,20 @@
// import assert from 'assert';
// import { encrypt, decrypt } from '../client/helpers/';
// describe("Helper::crypto", function() {
// it("can encrypt", function() {
// const key = "SUPER_KEY";
// const obj = {a: 3, b:4}
// const encrypted_obj = encrypt(obj, key);
// assert.ok(encrypted_obj);
// assert.notEqual(obj, encrypted_obj);
// });
// it("can decrypt", function() {
// const key = "SUPER_KEY";
// const obj = {a: 3, b:4}
// const encrypted_obj = encrypt(obj,key);
// const decrypted_obj = decrypt(encrypted_obj, key);
// assert.equal(JSON.stringify(obj), JSON.stringify(decrypted_obj));
// });
// });
+44
View File
@@ -0,0 +1,44 @@
// import assert from 'assert';
// import { event } from '../client/helpers/';
// describe("Helper::event", function() {
// afterEach(function(){
// event.fns = [];
// });
// it("can register", function() {
// assert.equal(0, event.fns.length);
// event.subscribe("event::test", function(){});
// assert.equal(1, event.fns.length);
// });
// it("can unregister", function() {
// assert.equal(0, event.fns.length);
// event.subscribe("event::test", function(){});
// assert.equal(1, event.fns.length);
// event.unsubscribe("event::test");
// assert.equal(0, event.fns.length);
// });
// it("can emit", function(done){
// event.subscribe('event::test', function(){
// done();
// });
// event.emit("event::test")
// });
// it("can emit multiple times", function(done){
// let count = 0;
// event.subscribe('event::test', function(){
// count += 1;
// if(count === 3){
// done();
// }else{
// assert.equal(true, count < 3);
// }
// });
// event.emit("event::test");
// event.emit("event::test");
// event.emit("event::test");
// });
// });
+24
View File
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>Mocha Tests</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>
<script>mocha.setup('bdd')</script>
<!-- Helpers -->
<!--<script type="module" src="/client/helpers/events.js"></script>-->
<script type="module" src="../client/helpers/crypto.js"></script>
<!-- load your test files here -->
<script>
mocha.run();
</script>
</body>
</html>
+29
View File
@@ -0,0 +1,29 @@
var tests = [];
for (var file in window.__karma__.files) {
if (window.__karma__.files.hasOwnProperty(file)) {
if (/Spec\.js$/.test(file)) {
tests.push(file);
}
}
}
requirejs.config({
baseUrl: '/base/src',
paths: {
'jquery': '../lib/jquery',
'underscore': '../lib/underscore',
},
shim: {
'underscore': {
exports: '_'
}
},
// ask Require.js to load these files (all our tests)
deps: tests,
// start test run, once Require.js is done
callback: window.__karma__.start
});