Skip to content

Commit

Permalink
refa: fix unit test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jul 11, 2022
1 parent 2c8b237 commit a90afd6
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 37 deletions.
4 changes: 2 additions & 2 deletions plugins/a11y/bind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"koishi": "^4.7.6"
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6"
}
}
}
4 changes: 2 additions & 2 deletions plugins/a11y/callme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"koishi": "^4.7.6"
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6"
}
}
}
4 changes: 2 additions & 2 deletions plugins/a11y/schedule/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
]
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6"
},
"peerDependencies": {
"koishi": "^4.7.6"
}
}
}
4 changes: 2 additions & 2 deletions plugins/a11y/sudo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
"koishi": "^4.7.6"
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6"
},
"dependencies": {
"@koishijs/helpers": "^1.2.3"
}
}
}
4 changes: 2 additions & 2 deletions plugins/a11y/suggest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"koishi": "^4.7.6"
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6"
}
}
}
4 changes: 2 additions & 2 deletions plugins/a11y/switch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"koishi": "^4.7.6"
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6"
},
"dependencies": {
"@koishijs/helpers": "^1.2.3"
}
}
}
4 changes: 2 additions & 2 deletions plugins/common/broadcast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"koishi": "^4.7.6"
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6"
}
}
}
3 changes: 2 additions & 1 deletion plugins/common/broadcast/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const app = new App({
delay: { broadcast: 0 },
})

app.plugin(mock, { selfIds: ['514', '114'] })
app.plugin(mock, { selfId: '514' })
app.plugin(mock, { selfId: '114' })
app.plugin(memory)
app.plugin(broadcast)

Expand Down
4 changes: 2 additions & 2 deletions plugins/common/forward/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"koishi": "^4.7.6"
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6"
},
"dependencies": {
"@koishijs/helpers": "^1.2.3"
}
}
}
4 changes: 2 additions & 2 deletions plugins/common/help/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"koishi": "^4.7.6"
},
"devDependencies": {
"@koishijs/plugin-database-memory": "^1.4.0",
"@koishijs/plugin-database-memory": "^1.4.1",
"@koishijs/plugin-mock": "^1.0.6",
"@koishijs/plugin-suggest": "^1.1.1"
}
}
}
2 changes: 1 addition & 1 deletion plugins/common/recall/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('@koishijs/plugin-recall', () => {
it('basic support', async () => {
const del = app.bots[0].deleteMessage = jest.fn(async () => {})
await client.shouldReply('recall', '近期没有发送消息。')
const session = await app.bots[0].session({ messageId: '1234', channelId: '456', guildId: '456' })
const session = app.bots[0].session({ messageId: '1234', channelId: '456', guildId: '456', type: 'send' })
app.mock.receive(session)
await client.shouldNotReply('recall')
expect(del.mock.calls).to.have.shape([[client.meta.channelId, '1234']])
Expand Down
4 changes: 2 additions & 2 deletions plugins/common/repeater/tests/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { App } from 'koishi'
import { Context } from 'koishi'
import mock from '@koishijs/plugin-mock'
import * as repeater from '@koishijs/plugin-repeater'

async function setup(config: repeater.Config) {
const app = new App()
const app = new Context()
app.plugin(mock)
const client1 = app.mock.client('123', '123')
const client2 = app.mock.client('456', '123')
Expand Down
6 changes: 3 additions & 3 deletions plugins/database/level/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-database-level",
"description": "LevelDB implementation for Koishi",
"version": "1.4.0",
"version": "1.4.1",
"main": "lib/node.js",
"module": "lib/browser.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -44,6 +44,6 @@
"koishi": "^4.7.6"
},
"dependencies": {
"@minatojs/driver-level": "^1.1.0"
"@minatojs/driver-level": "^1.1.1"
}
}
}
6 changes: 3 additions & 3 deletions plugins/database/memory/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-database-memory",
"description": "A in-memory database implementation for Koishi",
"version": "1.4.0",
"version": "1.4.1",
"main": "lib/node.js",
"module": "lib/browser.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -43,6 +43,6 @@
"koishi": "^4.7.6"
},
"dependencies": {
"@minatojs/driver-memory": "^1.1.0"
"@minatojs/driver-memory": "^1.1.1"
}
}
}
6 changes: 3 additions & 3 deletions plugins/database/mongo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-database-mongo",
"description": "MongoDB support for Koishi",
"version": "3.4.0",
"version": "3.4.1",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
Expand Down Expand Up @@ -44,6 +44,6 @@
"koishi": "^4.7.6"
},
"dependencies": {
"@minatojs/driver-mongo": "^1.2.0"
"@minatojs/driver-mongo": "^1.2.1"
}
}
}
6 changes: 3 additions & 3 deletions plugins/database/mysql/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-database-mysql",
"description": "MySQL support for Koishi",
"version": "4.5.0",
"version": "4.5.1",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
Expand Down Expand Up @@ -43,6 +43,6 @@
"koishi": "^4.7.6"
},
"dependencies": {
"@minatojs/driver-mysql": "^1.2.0"
"@minatojs/driver-mysql": "^1.2.1"
}
}
}
6 changes: 3 additions & 3 deletions plugins/database/sqlite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-database-sqlite",
"description": "SQLite support for Koishi",
"version": "1.4.0",
"version": "1.4.1",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
Expand Down Expand Up @@ -44,6 +44,6 @@
"koishi": "^4.7.6"
},
"dependencies": {
"@minatojs/driver-sqlite": "^1.2.0"
"@minatojs/driver-sqlite": "^1.2.1"
}
}
}
1 change: 1 addition & 0 deletions plugins/mock/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class MessageClient {
const send = async (content: string) => {
if (!content) return
const session = this.app.bots[0].session({ ...this.meta, content })
if (await this.app.serial(session, 'before-send', session)) return
if (!session?.content) return []
this.replies.push(session.content)
return []
Expand Down

0 comments on commit a90afd6

Please sign in to comment.