Skip to content

Commit

Permalink
atomise tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mixmix committed Sep 19, 2022
1 parent f470c64 commit 531db97
Show file tree
Hide file tree
Showing 12 changed files with 448 additions and 443 deletions.
32 changes: 21 additions & 11 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ exports.init = function (sbot, config) {
}

function v1FindOrCreate(details, cb) {
if (!details.feetformat) details.feedformat = 'classic'
if (!details.feedformat) details.feedformat = 'classic'

findOrCreate((err, rootFeed) => {
if (err) return cb(err)
Expand Down Expand Up @@ -249,17 +249,27 @@ exports.init = function (sbot, config) {
}

return {
getRoot,
findOrCreate,
findAndTombstone,
findById,
findByIdSync,
loadState,
ensureLoaded,
branchStream,

v1: {
findOrCreate: v1FindOrCreate,
findOrCreate: v1FindOrCreate,

advanced: {
getRoot,
findOrCreate,
findAndTombstone,
findById,
findByIdSync,
loadState,
ensureLoaded,

// TODO add API for whether to encrypt the announce message for a subfeed
// for sympathetic replication?
//
// ssb.db.create // allows
//
// QUESTION: should the groupKey be used for the determination of the location of the group subfeed (ideally don't use the same key for two different things right?)

// TODO findOrCreate thing for friends helsinki subfeed?
// lookup? feeds Lookup?
},
}
}
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
//
// SPDX-License-Identifier: LGPL-3.0-only

const API = require('./api')
const Keys = require('./keys')
const Messages = require('./messages')
const Lookup = require('./lookup')
const Query = require('./query')
const API = require('./api')
const Validate = require('./validate')
const FeedsLookup = require('./feeds-lookup')

exports.name = 'metafeeds'

exports.init = function (sbot, config) {
const messages = Messages.init(sbot, config)
const query = Query.init(sbot, config)
const lookup = FeedsLookup.init(sbot, config)
const lookup = Lookup.init(sbot, config)
const api = API.init(sbot, config)

return {
Expand Down
1 change: 1 addition & 0 deletions feeds-lookup.js → lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ exports.init = function (sbot, config) {
}

function branchStreamOld(rootMetafeedId) {
// WARNING this method needs loadState to be called?
const branches = []
if (rootMetafeedId) {
traverseBranchesUnder(rootMetafeedId, [], (branch) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"tape": "^5.6.0"
},
"scripts": {
"test": "tape test/*.js | tap-arc --bail",
"test": "tape \"test/**/*.test.js\" | tap-arc --bail",
"format-code": "prettier --write \"*.js\" \"test/*.js\"",
"format-code-staged": "pretty-quick --staged --pattern \"*.js\" --pattern \"test/*.js\"",
"coverage": "c8 --reporter=lcov npm run test"
Expand Down
Loading

0 comments on commit 531db97

Please sign in to comment.