Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
farskipper committed Jan 3, 2022
1 parent 8252c80 commit 9ed27f3
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 31 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on: push

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
node-version:
- lts/* # LTS version
- "17" # latest version
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- run: npm run setup
- run: npm test
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# pico-framework

[![Build Status](https://travis-ci.org/Picolab/pico-framework.svg)](https://travis-ci.org/Picolab/pico-framework)
[![codecov](https://codecov.io/gh/Picolab/pico-framework/branch/master/graph/badge.svg)](https://codecov.io/gh/Picolab/pico-framework)

A framework for building actor-based, people-centric systems. (pico = PersIstent Compute Objects)

## Why Picos?
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
"scripts": {
"prepublish": "npm run build",
"build": "rm -rf dist && tsc",
"test": "nyc ava",
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov"
"test": "nyc ava"
},
"dependencies": {
"charwise": "^3.0.1",
Expand All @@ -51,11 +50,10 @@
"@types/abstract-leveldown": "^5.0.1",
"@types/levelup": "^4.3.0",
"@types/lodash": "^4.14.157",
"ava": "^3.10.1",
"codecov": "^3.7.1",
"ava": "^4.0.0",
"nyc": "^15.1.0",
"ts-node": "^8.10.2",
"typescript": "^3.9.7"
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
},
"ava": {
"extensions": [
Expand Down
2 changes: 1 addition & 1 deletion src/Pico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export class Pico {
let data: any;
try {
data = await this.pf.db.get(["entvar", this.id, rid, name]);
} catch (err) {
} catch (err: any) {
if (err.notFound) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/PicoFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class PicoFramework {
let rootId: string | null;
try {
rootId = await this.db.get(["root-pico"]);
} catch (err) {
} catch (err: any) {
if (err.notFound) {
rootId = null;
} else {
Expand Down
29 changes: 15 additions & 14 deletions test/cleanQuery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from "ava";
import { cleanQuery } from "../src/PicoQuery";

test("query = cleanQuery(query)", function(t) {
test("query = cleanQuery(query)", function (t) {
try {
cleanQuery(null);
t.fail("should throw");
Expand Down Expand Up @@ -50,13 +50,13 @@ test("query = cleanQuery(query)", function(t) {
cleanQuery({
eci: "eci123",
rid: "foo",
name: "bar"
name: "bar",
}),
{
eci: "eci123",
rid: "foo",
name: "bar",
args: {}
args: {},
}
);

Expand All @@ -66,13 +66,13 @@ test("query = cleanQuery(query)", function(t) {
eci: "eci123",
rid: "foo",
name: "bar",
args: args
args: args,
});
t.deepEqual(query, {
eci: "eci123",
rid: "foo",
name: "bar",
args: args
args: args,
});
t.deepEqual(query.args, args, "they should match before query.args mutates");
query.args.what = "blah";
Expand All @@ -84,13 +84,13 @@ test("query = cleanQuery(query)", function(t) {
eci: " eci123 ",
rid: " foo\n ",
name: " \t bar ",
args: { " foo ": " don't trim these " }
args: { " foo ": " don't trim these " },
}),
{
eci: "eci123",
rid: "foo",
name: "bar",
args: { " foo ": " don't trim these " }
args: { " foo ": " don't trim these " },
}
);

Expand All @@ -100,13 +100,13 @@ test("query = cleanQuery(query)", function(t) {
eci: "eci123",
rid: "foo",
name: "bar",
timestamp: new Date()
timestamp: new Date(),
}),
{
eci: "eci123",
rid: "foo",
name: "bar",
args: {}
args: {},
}
);

Expand All @@ -116,13 +116,13 @@ test("query = cleanQuery(query)", function(t) {
eci: "eci123",
rid: "foo",
name: "bar",
for_rid: "rid"
for_rid: "rid",
}),
{
eci: "eci123",
rid: "foo",
name: "bar",
args: {}
args: {},
}
);

Expand All @@ -131,7 +131,7 @@ test("query = cleanQuery(query)", function(t) {
eci: "eci123",
rid: "foo",
name: "bar",
args
args,
}).args;
}

Expand All @@ -146,14 +146,15 @@ test("query = cleanQuery(query)", function(t) {
const a = { one: 2 };
const b = cleanArgs(a);
t.false(a === b, "must be a clone");
// @ts-ignore
t.deepEqual(a, b);
b.extra = 3;
t.notDeepEqual(a, b);

t.deepEqual(
cleanArgs({
one: 2,
three: function() {}
three: function () {},
}),
{ one: 2 },
"remove non-jsonable things"
Expand All @@ -165,7 +166,7 @@ test("query = cleanQuery(query)", function(t) {
"args normalize to JSON null's"
);

(function(a, b) {
(function (a, b) {
t.deepEqual(
cleanArgs(arguments),
{ "0": "foo", "1": "bar" },
Expand Down

0 comments on commit 9ed27f3

Please sign in to comment.