Skip to content

Commit

Permalink
feat: functional dns server
Browse files Browse the repository at this point in the history
  • Loading branch information
Eyzi committed Aug 14, 2021
1 parent a3a5796 commit 426fb39
Show file tree
Hide file tree
Showing 41 changed files with 15,131 additions and 1,422 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"scripts": {
"build": "yarn build:common && lerna run build --since --parallel",
"build:clean": "yarn clean && yarn build:install",
"build:common": "lerna run build:common --since --parallel",
"build:common": "lerna run build:common --parallel",
"build:install": "lerna bootstrap && yarn build",
"build:test": "yarn build && yarn test",
"clean": "lerna run clean --parallel",
"lerna:clean": "lerna run lerna:clean --parallel",
"lerna:link": "lerna run lerna:link --parallel",
Expand Down
31 changes: 31 additions & 0 deletions packages/acme/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/acme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@
},
"bugs": {
"url": "https://github.com/eyzi/beatrice/issues"
},
"dependencies": {
"@beatrice/common": "^0.1.1",
"dotenv": "^10.0.0"
}
}
11 changes: 11 additions & 0 deletions packages/common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `@beatrice/common`

> TODO: description
## Usage

```
const common = require('@beatrice/common');
// TODO: DEMONSTRATE API
```
60 changes: 60 additions & 0 deletions packages/common/__tests__/services/repository.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { expect } from "chai";
import { stub } from "sinon";
import {
persistenceCreate,
persistenceGet,
persistenceQuery,
persistenceUpdate,
persistenceDelete,
} from "../../src/services/repository"
import { Id } from "../../src/types";

type Test = { id: Id }
type TestQuery = {}
const sampleRepository = {
create: async () => ({ id: "test-id" }),
get: async () => ({ id: "test-id" }),
query: async () => [],
update: async () => ({ id: "test-id" }),
delete: async () => true
}

describe("persistenceCreate", () => {
it("should call create function", () => {
const fn = stub(sampleRepository, "create")
persistenceCreate<Test>(sampleRepository, {})
expect(fn.calledOnce).to.be.true
})
})

describe("persistenceGet", () => {
it("should call get function", () => {
const fn = stub(sampleRepository, "get")
persistenceGet<Test>(sampleRepository, "test-id")
expect(fn.calledOnce).to.be.true
})
})

describe("persistenceQuery", () => {
it("should call query function", () => {
const fn = stub(sampleRepository, "query")
persistenceQuery<Test, TestQuery>(sampleRepository, {})
expect(fn.calledOnce).to.be.true
})
})

describe("persistenceUpdate", () => {
it("should call update function", () => {
const fn = stub(sampleRepository, "update")
persistenceUpdate<Test>(sampleRepository, { id: "test-id" }, {})
expect(fn.calledOnce).to.be.true
})
})

describe("persistenceDelete", () => {
it("should call delete function", () => {
const fn = stub(sampleRepository, "delete")
persistenceDelete<Test>(sampleRepository, { id: "test-id" })
expect(fn.calledOnce).to.be.true
})
})
Loading

0 comments on commit 426fb39

Please sign in to comment.