Skip to content

Commit

Permalink
lining fixes (#65)
Browse files Browse the repository at this point in the history
* lining fixes

* 1.12.2
  • Loading branch information
atorber authored Jan 17, 2024
1 parent 157bca7 commit 4b484ec
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechaty-plugin-contrib",
"version": "1.12.1",
"version": "1.12.2",
"description": "Wechaty Plugin Ecosystem Contrib Package",
"type": "module",
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions src/contrib/ding-dong/ding-dong.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test('isMatchConfig {mention: true}', async t => {

const mentionMessage = await new Promise<Message>(resolve => {
room.once('message', resolve)
fixture.mocker.player.say('ding', [fixture.mocker.bot]).to(fixture.mocker.room)
fixture.mocker.player.say('ding', [ fixture.mocker.bot ]).to(fixture.mocker.room)
})
let result: boolean = await isMatch(mentionMessage)
t.equal(result, true, 'should match for room mention self message')
Expand All @@ -54,7 +54,7 @@ test('isMatchConfig {mention: false}', async t => {

const mentionMessage = await new Promise<Message>(resolve => {
room.once('message', resolve)
fixture.mocker.player.say('ding', [fixture.mocker.bot]).to(fixture.mocker.room)
fixture.mocker.player.say('ding', [ fixture.mocker.bot ]).to(fixture.mocker.room)
})
let result: boolean = await isMatch(mentionMessage)
t.equal(result, true, 'should match for room mention self message')
Expand Down
4 changes: 2 additions & 2 deletions src/finders/contact-finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function contactFinder (options?: ContactFinderOptions): ContactFinderFun
}

if (!Array.isArray(options)) {
options = [options]
options = [ options ]
}

const optionList = options
Expand All @@ -42,7 +42,7 @@ export function contactFinder (options?: ContactFinderOptions): ContactFinderFun
}
}

const dedupedContactList = [...new Set(allContactList.filter(Boolean))]
const dedupedContactList = [ ...new Set(allContactList.filter(Boolean)) ]
return dedupedContactList
}
}
4 changes: 2 additions & 2 deletions src/finders/room-finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function roomFinder (options?: RoomFinderOptions): RoomFinderFunction {
}

if (!Array.isArray(options)) {
options = [options]
options = [ options ]
}

const optionList = options
Expand All @@ -41,7 +41,7 @@ export function roomFinder (options?: RoomFinderOptions): RoomFinderFunction {
}
}

const dedupedRoomList = [...new Set(allRoomList.filter(Boolean))]
const dedupedRoomList = [ ...new Set(allRoomList.filter(Boolean)) ]
return dedupedRoomList
}
}
2 changes: 1 addition & 1 deletion src/mappers/message-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function normalizeMappedMessageList (
if (Array.isArray(options)) {
optionList = options
} else {
optionList = [options]
optionList = [ options ]
}

for (const option of optionList) {
Expand Down
6 changes: 3 additions & 3 deletions src/matchers/contact-matcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test('contactMatcher() with string option', async t => {
t.ok(await idMatcher(contactIdOk), 'should match expected contact by id')
t.notOk(await idMatcher(contactNameOk), 'should not match contact by name')

const idListMatcher = contactMatcher([TEXT_OK])
const idListMatcher = contactMatcher([ TEXT_OK ])

t.notOk(await idListMatcher(contactNotOk), 'should not match unexpected contact by id list')

Expand All @@ -57,7 +57,7 @@ test('contactMatcher() with string option', async t => {
t.notOk(await regexpMatcher(contactIdOk), 'should match contact id by regexp')
t.ok(await regexpMatcher(contactNameOk), 'should match expected contact name by regexp')

const regexpListMatcher = contactMatcher([new RegExp(TEXT_OK)])
const regexpListMatcher = contactMatcher([ new RegExp(TEXT_OK) ])

t.notOk(await regexpListMatcher(contactNotOk), 'should not match unexpected contact by regexp list')

Expand All @@ -76,7 +76,7 @@ test('contactMatcher() with string option', async t => {
t.ok(await functionMatcher(contactNameOk), 'should match expected name by function')
t.ok(await functionMatcher(contactIdOk), 'should match expected id by function')

const functionListMatcher = contactMatcher([roomFilter])
const functionListMatcher = contactMatcher([ roomFilter ])

t.notOk(await functionListMatcher(contactNotOk), 'should not match unexpected contact by function list')

Expand Down
2 changes: 1 addition & 1 deletion src/matchers/contact-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function contactMatcher (
}

if (!Array.isArray(matcherOptions)) {
matcherOptions = [matcherOptions]
matcherOptions = [ matcherOptions ]
}

const matcherOptionList = matcherOptions
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/language-matcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test('languageMatcher() with array options', async t => {
const CHINESE_TEXT = '你好'
const ENGLISH_TEXT = 'hello'

const matchLanguage = languageMatcher(['chinese', 'english'])
const matchLanguage = languageMatcher([ 'chinese', 'english' ])

let result = matchLanguage(CHINESE_TEXT)
t.ok(result, 'should match Chinese language')
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/language-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function languageMatcher (
if (Array.isArray(options)) {
codeList = options
} else {
codeList = [options]
codeList = [ options ]
}

return function matchLanguage (text: string) {
Expand Down
6 changes: 3 additions & 3 deletions src/matchers/message-matcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test('messageMatcher() with string option', async t => {
t.ok(await idMatcher(messageTopicOk), 'should match expected topic by id')
t.ok(await idMatcher(messageIdOk), 'should match expected text by id')

const idListMatcher = messageMatcher([TEXT_OK])
const idListMatcher = messageMatcher([ TEXT_OK ])

t.notOk(await idListMatcher(messageNotOk), 'should not match unexpected message by id list')

Expand All @@ -90,7 +90,7 @@ test('messageMatcher() with string option', async t => {
t.ok(await regexpMatcher(messageTopicOk), 'should match expected topic by regexp')
t.ok(await regexpMatcher(messageTextOk), 'should match expected text by regexp')

const regexpListMatcher = messageMatcher([new RegExp(TEXT_OK)])
const regexpListMatcher = messageMatcher([ new RegExp(TEXT_OK) ])

t.notOk(await regexpListMatcher(messageNotOk), 'should not match unexpected message by regexp')

Expand All @@ -112,7 +112,7 @@ test('messageMatcher() with string option', async t => {
t.ok(await functionMatcher(messageTopicOk), 'should match expected topic by function')
t.ok(await functionMatcher(messageTextOk), 'should match expected text by function')

const functionListMatcher = messageMatcher([messageFilter])
const functionListMatcher = messageMatcher([ messageFilter ])

t.notOk(await functionListMatcher(messageNotOk), 'should not match unexpected message by function list')

Expand Down
2 changes: 1 addition & 1 deletion src/matchers/message-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function messageMatcher (
}

if (!Array.isArray(matcherOptions)) {
matcherOptions = [matcherOptions]
matcherOptions = [ matcherOptions ]
}

const matcherOptionList = matcherOptions
Expand Down
6 changes: 3 additions & 3 deletions src/matchers/room-matcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test('roomMatcher() with string option', async t => {
t.ok(await idMatcher(roomIdOk), 'should match expected room by id')
t.notOk(await idMatcher(roomTopicOk), 'should not match room by topic')

const idListMatcher = roomMatcher([TEXT_OK])
const idListMatcher = roomMatcher([ TEXT_OK ])

t.notOk(await idListMatcher(roomNotOk), 'should not match unexpected room by id list')

Expand All @@ -58,7 +58,7 @@ test('roomMatcher() with string option', async t => {
t.notOk(await regexpMatcher(roomIdOk), 'should match room id by regexp')
t.ok(await regexpMatcher(roomTopicOk), 'should match expected room topic by regexp')

const regexpListMatcher = roomMatcher([new RegExp(TEXT_OK)])
const regexpListMatcher = roomMatcher([ new RegExp(TEXT_OK) ])

t.notOk(await regexpListMatcher(roomNotOk), 'should not match unexpected room by regexp list')

Expand All @@ -77,7 +77,7 @@ test('roomMatcher() with string option', async t => {
t.ok(await functionMatcher(roomTopicOk), 'should match expected topic by function')
t.ok(await functionMatcher(roomIdOk), 'should match expected id by function')

const functionListMatcher = roomMatcher([roomFilter])
const functionListMatcher = roomMatcher([ roomFilter ])

t.notOk(await functionListMatcher(roomNotOk), 'should not match unexpected room by function list')

Expand Down
2 changes: 1 addition & 1 deletion src/matchers/room-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function roomMatcher (
}

if (!Array.isArray(matcherOptions)) {
matcherOptions = [matcherOptions]
matcherOptions = [ matcherOptions ]
}

const matcherOptionList = matcherOptions
Expand Down
6 changes: 3 additions & 3 deletions src/matchers/string-matcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ test('stringMatcher()', async t => {
t.ok(await textMatcher(TEXT_OK), 'should match expected TEXT')
t.notOk(await textMatcher(TEXT_NOT_OK), 'should not match unexpected string')

const textListMatcher = stringMatcher([TEXT_OK])
const textListMatcher = stringMatcher([ TEXT_OK ])
t.ok(await textListMatcher(TEXT_OK), 'should match expected TEXT by list')
t.notOk(await textListMatcher(TEXT_NOT_OK), 'should not match unexpected string by list')

const regexpMatcher = stringMatcher(new RegExp(TEXT_OK))
t.notOk(await regexpMatcher(TEXT_NOT_OK), 'should not match unexpected string by regexp')
t.ok(await regexpMatcher(TEXT_OK), 'should match expected from by regexp')

const regexpListMatcher = stringMatcher([new RegExp(TEXT_OK)])
const regexpListMatcher = stringMatcher([ new RegExp(TEXT_OK) ])
t.notOk(await regexpListMatcher(TEXT_NOT_OK), 'should not match unexpected string by regexp list')
t.ok(await regexpListMatcher(TEXT_OK), 'should match expected from by regexp list')

Expand All @@ -39,7 +39,7 @@ test('stringMatcher()', async t => {
t.notOk(await functionMatcher(TEXT_NOT_OK), 'should not match unexpected string by function')
t.ok(await functionMatcher(TEXT_OK), 'should match expected from by function')

const functionListMatcher = stringMatcher([stringFilter])
const functionListMatcher = stringMatcher([ stringFilter ])
t.notOk(await functionListMatcher(TEXT_NOT_OK), 'should not match unexpected string by function list')
t.ok(await functionListMatcher(TEXT_OK), 'should match expected from by function list')
})
2 changes: 1 addition & 1 deletion src/matchers/string-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function stringMatcher (
}

if (!Array.isArray(options)) {
options = [options]
options = [ options ]
}

const optionsList = options
Expand Down
2 changes: 1 addition & 1 deletion src/talkers/contact-talker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('contactTalker()', async t => {

const OPTIONS_TEXT: ContactTalkerOptions = EXPECTED_TEXT
const OPTIONS_FUNCTION: ContactTalkerOptions = spy1
const OPTIONS_FUNCTION_LIST: ContactTalkerOptions = [spy2, spy3]
const OPTIONS_FUNCTION_LIST: ContactTalkerOptions = [ spy2, spy3 ]

const mockContact = {
say: spy4,
Expand Down
2 changes: 1 addition & 1 deletion src/talkers/contact-talker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function contactTalker<T = void> (options?: ContactTalkerOptions) {
}

if (!Array.isArray(options)) {
options = [options]
options = [ options ]
}

const optionList = options
Expand Down
2 changes: 1 addition & 1 deletion src/talkers/message-talker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('messageTalker()', async t => {
const EXPECTED_TEXT = 'text'

const OPTIONS_TEXT: MessageTalkerOptions = EXPECTED_TEXT
const OPTIONS_FUNCTION_LIST: MessageTalkerOptions = [spy2, spy3]
const OPTIONS_FUNCTION_LIST: MessageTalkerOptions = [ spy2, spy3 ]

const mockMessage = {
say: spy4,
Expand Down
8 changes: 4 additions & 4 deletions src/talkers/room-talker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('roomTalker()', async t => {
const EXPECTED_TEXT = 'text'

const OPTIONS_TEXT: RoomTalkerOptions = EXPECTED_TEXT
const OPTIONS_FUNCTION_LIST: RoomTalkerOptions = [spy2, spy3]
const OPTIONS_FUNCTION_LIST: RoomTalkerOptions = [ spy2, spy3 ]

const mockContact = {} as any as Contact
const mockRoom = {
Expand Down Expand Up @@ -84,7 +84,7 @@ test('roomTalker() with room list', async t => {
const EXPECTED_TEXT = 'text'

const OPTIONS_TEXT: RoomTalkerOptions = EXPECTED_TEXT
const OPTIONS_FUNCTION_LIST: RoomTalkerOptions = [spy2, spy3]
const OPTIONS_FUNCTION_LIST: RoomTalkerOptions = [ spy2, spy3 ]

const mockContact1 = {} as any as Contact
const mockContact2 = {} as any as Contact
Expand All @@ -105,7 +105,7 @@ test('roomTalker() with room list', async t => {

let talkRoom = roomTalker(OPTIONS_TEXT)
spy4.resetHistory()
await talkRoom([mockRoom1, mockRoom2], [mockContact1, mockContact2])
await talkRoom([ mockRoom1, mockRoom2 ], [ mockContact1, mockContact2 ])
t.ok(spy4.calledOnce, 'should called the room1.say once')
t.equal(spy4.args[0]![0], EXPECTED_TEXT, 'should say the expected text')
t.equal(spy4.args[0]![1], mockContact1, 'should pass contact1 to say')
Expand All @@ -118,7 +118,7 @@ test('roomTalker() with room list', async t => {
talkRoom = roomTalker(OPTIONS_FUNCTION_LIST)
spy2.resetHistory()
spy3.resetHistory()
await talkRoom([mockRoom1, mockRoom2], [mockContact1, mockContact2])
await talkRoom([ mockRoom1, mockRoom2 ], [ mockContact1, mockContact2 ])
t.ok(spy2.called, 'should called the functions 1')
t.equal(spy2.args[0]![0], mockRoom1, 'should called the functions 1/1 with mockRoom1')
t.equal(spy2.args[0]![1], mockContact1, 'should called the functions 1/2 with mockContact1')
Expand Down
6 changes: 3 additions & 3 deletions src/talkers/room-talker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function roomTalker<T = void> (options?: RoomTalkerOptions) {
}

if (!Array.isArray(options)) {
options = [options]
options = [ options ]
}

const optionList = options
Expand All @@ -39,12 +39,12 @@ export function roomTalker<T = void> (options?: RoomTalkerOptions) {
)

if (!Array.isArray(rooms)) {
rooms = [rooms]
rooms = [ rooms ]
}
if (typeof contacts === 'undefined') {
contacts = []
} else if (!Array.isArray(contacts)) {
contacts = [contacts]
contacts = [ contacts ]
}

for (const room of rooms) {
Expand Down

0 comments on commit 4b484ec

Please sign in to comment.