mirror of
https://github.com/amark/gun.git
synced 2025-06-03 20:56:43 +00:00
Merge branch 'sea' into master
This commit is contained in:
commit
ff16aff04f
1
sea.js
1
sea.js
@ -389,6 +389,7 @@
|
||||
var shim = USE('./shim');
|
||||
var S = USE('./settings');
|
||||
var sha256hash = USE('./sha256');
|
||||
var u;
|
||||
|
||||
SEA.sign = SEA.sign || (async (data, pair, cb, opt) => { try {
|
||||
if(data && data.slice
|
||||
|
61
test/sea/sea2.js
Normal file
61
test/sea/sea2.js
Normal file
@ -0,0 +1,61 @@
|
||||
/* global Gun,describe,expect,it,beforeEach */
|
||||
/*eslint max-len: ["error", 95, { "ignoreComments": true }]*/
|
||||
/*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}]*/
|
||||
/*eslint object-curly-spacing: ["error", "never"]*/
|
||||
/*eslint node/no-deprecated-api: [error, {ignoreModuleItems: ["new buffer.Buffer()"]}] */
|
||||
|
||||
var root;
|
||||
var Gun;
|
||||
(function(env){
|
||||
root = env.window ? env.window : global;
|
||||
env.window && root.localStorage && root.localStorage.clear();
|
||||
try{ require('fs').unlinkSync('data.json') }catch(e){}
|
||||
//root.Gun = root.Gun || require('../gun');
|
||||
if(root.Gun){
|
||||
//Gun = root.Gun = root.Gun;
|
||||
} else {
|
||||
var expect = global.expect = require("../expect");
|
||||
root.Gun = require('../../gun');
|
||||
//Gun.serve = require('../../lib/serve');
|
||||
//require('./s3');
|
||||
//require('./uws');
|
||||
//require('./wsp/server');
|
||||
require('../../lib/file');
|
||||
require('../../sea.js');
|
||||
}
|
||||
}(this));
|
||||
|
||||
;(function(){
|
||||
Gun = root.Gun
|
||||
const SEA = Gun.SEA
|
||||
|
||||
if(!SEA){ return }
|
||||
|
||||
describe('SEA', function(){
|
||||
var user;
|
||||
var gun;
|
||||
it('is instantiable', done => {
|
||||
gun = Gun({ localStorage: true, radisk: false })
|
||||
user = gun.user()
|
||||
done()
|
||||
})
|
||||
|
||||
it('register users', async done => {
|
||||
user.create('bob', 'test123', ack => {
|
||||
expect(ack.err).to.not.be.ok();
|
||||
setTimeout(done, 30)
|
||||
})
|
||||
})
|
||||
|
||||
it('login users', async done => {
|
||||
console.log("------------------");
|
||||
user.auth('bob', 'test123', ack => {
|
||||
console.log("?????", ack, SEA.err);
|
||||
expect(ack.err).to.not.be.ok();
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})()
|
Loading…
x
Reference in New Issue
Block a user