change path

This commit is contained in:
0xtsukino
2022-08-03 03:34:42 -07:00
parent 9464f7cab6
commit 1fd8b9cba3
4 changed files with 95 additions and 94 deletions

View File

@@ -17,5 +17,6 @@
"twBearerToken": "twBearerToken",
"twAccessKey": "twAccessKey",
"twAccessSecret": "twAccessSecret",
"rapidAPIKey": "rapidAPIKey"
"rapidAPIKey": "rapidAPIKey",
"web3StorageAPIKey": "asdfasdf"
}

View File

@@ -323,13 +323,13 @@ tape('DBService', async t => {
'should return all records',
);
// @ts-ignore
const sema1 = await db.semaphore!.findOneByCommitment('11478604443530795445406842905228486956674818902660313591870165575138495663261');
t.deepEqual(
sema1!.provider,
'twitter',
'should return one semaphore row',
);
// // @ts-ignore
// const sema1 = await db.semaphore!.findOneByCommitment('11478604443530795445406842905228486956674818902660313591870165575138495663261');
// t.deepEqual(
// sema1!.provider,
// 'twitter',
// 'should return one semaphore row',
// );
// @ts-ignore
const sema2 = await db.semaphore!.findAllByCommitment('11478604443530795445406842905228486956674818902660313591870165575138495663261');
@@ -407,7 +407,7 @@ tape('DBService', async t => {
const user4 = await db.users!.search('yaga', '0x3F425586D68616A113C29c303766DAD444167EE8', 0, 2);
t.deepEqual(
user4,
[ { username: '0xd44a82dD160217d46D754a03C8f841edF06EBE3c', address: '0xd44a82dD160217d46D754a03C8f841edF06EBE3c', joinedTx: '0x9e532171096cf4f4fe68cd384addf3baaf31644c48506cb4550efb586a165c5a', type: 'arbitrum', pubkey: 'dBgXJATrP4KeE6zfuR4_arauMIeT_86MrQg6JbbnuxM.yJXykCW6qjB54B29by8vIWoMwk8T5NG_3awHdKC9Bgc', joinedAt: 1644251733000, name: 'yagamilight', bio: '', profileImage: 'https://i1.sndcdn.com/artworks-000452560338-e3uzc2-t500x500.jpg', coverImage: 'https://s3.amazonaws.com/99Covers-Facebook-Covers/watermark/14238.jpg', twitterVerification: 'https://twitter.com/0xTsukino/status/1465332814937690114', website: '', meta: { blockedCount: 0, blockingCount: 0, followerCount: 4, followingCount: 4, postingCount: 22, mentionedCount: 2, followed: '0x3F425586D68616A113C29c303766DAD444167EE8/6cb3a3eea1355ead9cbcb0907e282eac3d1f606d7a8d77252445404a09d58584', blocked: null } } ],
[ { username: '0xd44a82dD160217d46D754a03C8f841edF06EBE3c', address: '0xd44a82dD160217d46D754a03C8f841edF06EBE3c', joinedTx: '0x9e532171096cf4f4fe68cd384addf3baaf31644c48506cb4550efb586a165c5a', type: 'arbitrum', pubkey: 'dBgXJATrP4KeE6zfuR4_arauMIeT_86MrQg6JbbnuxM.yJXykCW6qjB54B29by8vIWoMwk8T5NG_3awHdKC9Bgc', joinedAt: 1644251733000, name: 'yagamilight', bio: '', profileImage: 'https://i1.sndcdn.com/artworks-000452560338-e3uzc2-t500x500.jpg', coverImage: 'https://s3.amazonaws.com/99Covers-Facebook-Covers/watermark/14238.jpg', twitterVerification: 'https://twitter.com/0xTsukino/status/1465332814937690114', website: '', ecdh: '', idcommitment: '', meta: { blockedCount: 0, blockingCount: 0, followerCount: 4, followingCount: 4, postingCount: 22, mentionedCount: 2, followed: '0x3F425586D68616A113C29c303766DAD444167EE8/6cb3a3eea1355ead9cbcb0907e282eac3d1f606d7a8d77252445404a09d58584', blocked: null } } ],
'should search user by name',
);
@@ -415,7 +415,7 @@ tape('DBService', async t => {
const user5 = await db.users!.search('oh', '0x3F425586D68616A113C29c303766DAD444167EE8', 0, 2);
t.deepEqual(
user5,
[ { username: '0x3E1E26f055Cd29053D44Fc65aa1FCa216DedFceb', address: '0x3E1E26f055Cd29053D44Fc65aa1FCa216DedFceb', joinedTx: '0xfde1d05921ccb073f71b747fd323fa313d51c77db82311993555692881ff9387', type: 'arbitrum', pubkey: 'MNw7njaTh0k835aq0JKtmpq33izkGwFxdldqf3txB64.a-yzwTFi1hNP-4lrpHB5NAw7p100oAOUefpYwfLPer8', joinedAt: 1644254074000, name: 'Ohwee', bio: '', profileImage: '', coverImage: '', twitterVerification: '', website: '', meta: { blockedCount: 0, blockingCount: 0, followerCount: 2, followingCount: 3, postingCount: 7, mentionedCount: 2, followed: null, blocked: null } } ],
[ { username: '0x3E1E26f055Cd29053D44Fc65aa1FCa216DedFceb', address: '0x3E1E26f055Cd29053D44Fc65aa1FCa216DedFceb', joinedTx: '0xfde1d05921ccb073f71b747fd323fa313d51c77db82311993555692881ff9387', type: 'arbitrum', pubkey: 'MNw7njaTh0k835aq0JKtmpq33izkGwFxdldqf3txB64.a-yzwTFi1hNP-4lrpHB5NAw7p100oAOUefpYwfLPer8', joinedAt: 1644254074000, name: 'Ohwee', bio: '', profileImage: '', coverImage: '', twitterVerification: '', website: '', ecdh: '', idcommitment: '', meta: { blockedCount: 0, blockingCount: 0, followerCount: 2, followingCount: 3, postingCount: 7, mentionedCount: 2, followed: null, blocked: null } } ],
'should search user by name',
);

View File

@@ -20,9 +20,9 @@ import {HASHTAG_REGEX, MENTION_REGEX} from "../util/regex";
import vKey from "../../static/verification_key.json";
import {showStatus} from "../util/twitter";
const Graph = require("gun/src/graph");
const State = require("gun/src/state");
const Val = require("gun/src/val");
const Graph = require("../../node_modules/gun/src/graph");
const State = require("../../node_modules/gun/src/state");
const Val = require("../../node_modules/gun/src/val");
const getMutex = new Mutex();
const putMutex = new Mutex();

View File

@@ -74,30 +74,30 @@ tape('InterepService.start', async (t: any) => {
t.end();
});
tape('InterepService.addId', async t => {
await interrep.addID('0x123456', 'autism', 'gold');
t.same(
sempahore.addID.args[0],
['0x123456', 'autism', 'gold'],
'should add new id to semaphore database',
);
sempahore.addID.reset();
t.end();
});
tape('InterepService.removeID', async t => {
await interrep.removeID('0x123456', 'autism', 'gold');
t.same(
sempahore.removeID.args[0],
['0x123456', 'autism', 'gold'],
'should remove id from semaphore database',
);
sempahore.removeID.reset();
t.end();
});
// tape('InterepService.addId', async t => {
// await interrep.addID('0x123456', 'autism', 'gold');
//
// t.same(
// sempahore.addID.args[0],
// ['0x123456', 'autism', 'gold'],
// 'should add new id to semaphore database',
// );
//
// sempahore.addID.reset();
// t.end();
// });
//
// tape('InterepService.removeID', async t => {
// await interrep.removeID('0x123456', 'autism', 'gold');
//
// t.same(
// sempahore.removeID.args[0],
// ['0x123456', 'autism', 'gold'],
// 'should remove id from semaphore database',
// );
// sempahore.removeID.reset();
// t.end();
// });
tape('InterepService.getBatchFromRootHash', async t => {
fetchStub.returns(Promise.resolve({
@@ -187,60 +187,60 @@ tape('InterepService.inProvider', async t => {
t.end();
});
tape('InterepService.scanIDCommitment', async t => {
fetchStub.returns(Promise.resolve({
json: async () => ({ data: true }),
}));
await interrep.scanIDCommitment('0x123456');
t.same(
fetchStub.args,
[
[ 'https://kovan.interep.link/api/v1/providers/twitter/0x123456' ],
[ 'https://kovan.interep.link/api/v1/groups/twitter/gold/0x123456/proof' ],
[ 'https://kovan.interep.link/api/v1/providers/github/0x123456' ],
[ 'https://kovan.interep.link/api/v1/providers/reddit/0x123456' ]
],
);
t.same(
sempahore.addID.args[0],
[ '0x123456', 'twitter', 'gold' ] ,
);
t.notOk(sempahore.removeID.args[0]);
fetchStub.reset();
sempahore.addID.reset();
let i = true;
fetchStub.returns(Promise.resolve({
json: async () => {
i = !i;
return !i ? { data: true }: false;
},
}));
await interrep.scanIDCommitment('0x3456789');
t.same(
fetchStub.args,
[
[ 'https://kovan.interep.link/api/v1/providers/twitter/0x3456789' ],
[ 'https://kovan.interep.link/api/v1/groups/twitter/gold/0x3456789/proof' ],
[ 'https://kovan.interep.link/api/v1/providers/github/0x3456789' ],
[ 'https://kovan.interep.link/api/v1/providers/reddit/0x3456789' ]
],
);
t.notOk(sempahore.addID.args[0]);
t.same(
sempahore.removeID.args[0],
[ '0x3456789', 'twitter', 'gold' ] ,
);
fetchStub.reset();
t.end();
});
// tape('InterepService.scanIDCommitment', async t => {
// fetchStub.returns(Promise.resolve({
// json: async () => ({ data: true }),
// }));
//
// await interrep.scanIDCommitment('0x123456');
//
// t.same(
// fetchStub.args,
// [
// [ 'https://kovan.interep.link/api/v1/providers/twitter/0x123456' ],
// [ 'https://kovan.interep.link/api/v1/groups/twitter/gold/0x123456/proof' ],
// [ 'https://kovan.interep.link/api/v1/providers/github/0x123456' ],
// [ 'https://kovan.interep.link/api/v1/providers/reddit/0x123456' ]
// ],
// );
//
// t.same(
// sempahore.addID.args[0],
// [ '0x123456', 'twitter', 'gold' ] ,
// );
//
// t.notOk(sempahore.removeID.args[0]);
//
// fetchStub.reset();
// sempahore.addID.reset();
//
// let i = true;
// fetchStub.returns(Promise.resolve({
// json: async () => {
// i = !i;
// return !i ? { data: true }: false;
// },
// }));
//
// await interrep.scanIDCommitment('0x3456789');
//
// t.same(
// fetchStub.args,
// [
// [ 'https://kovan.interep.link/api/v1/providers/twitter/0x3456789' ],
// [ 'https://kovan.interep.link/api/v1/groups/twitter/gold/0x3456789/proof' ],
// [ 'https://kovan.interep.link/api/v1/providers/github/0x3456789' ],
// [ 'https://kovan.interep.link/api/v1/providers/reddit/0x3456789' ]
// ],
// );
//
// t.notOk(sempahore.addID.args[0]);
// t.same(
// sempahore.removeID.args[0],
// [ '0x3456789', 'twitter', 'gold' ] ,
// );
//
// fetchStub.reset();
//
// t.end();
// });