11import { LogLevel } from '@slack/logger' ;
2- import { assert } from '../helpers/ assert' ;
2+ import assert from 'node: assert/strict ' ;
33import sinon from 'sinon' ;
44import { ErrorCode } from '../../../src/errors' ;
55import SocketModeReceiver from '../../../src/receivers/SocketModeReceiver' ;
@@ -35,13 +35,17 @@ describe('App basic features', () => {
3535 const MockApp = importApp ( overrides ) ;
3636 const app = new MockApp ( { token : '' , signingSecret : '' , port : 9999 } ) ;
3737 // biome-ignore lint/complexity/useLiteralKeys: reaching into private fields
38- assert . propertyVal ( app [ 'receiver' ] , 'port' , 9999 ) ;
38+ assert . ok ( app [ 'receiver' ] && typeof app [ 'receiver' ] === 'object' ) ;
39+ assert . ok ( 'port' in app [ 'receiver' ] ) ;
40+ assert . deepStrictEqual ( ( app [ 'receiver' ] as unknown as Record < PropertyKey , unknown > ) [ 'port' ] , 9999 ) ;
3941 } ) ;
4042 it ( 'should accept a port value under installerOptions' , async ( ) => {
4143 const MockApp = importApp ( overrides ) ;
4244 const app = new MockApp ( { token : '' , signingSecret : '' , port : 7777 , installerOptions : { port : 9999 } } ) ;
4345 // biome-ignore lint/complexity/useLiteralKeys: reaching into private fields
44- assert . propertyVal ( app [ 'receiver' ] , 'port' , 9999 ) ;
46+ assert . ok ( app [ 'receiver' ] && typeof app [ 'receiver' ] === 'object' ) ;
47+ assert . ok ( 'port' in app [ 'receiver' ] ) ;
48+ assert . deepStrictEqual ( ( app [ 'receiver' ] as unknown as Record < PropertyKey , unknown > ) [ 'port' ] , 9999 ) ;
4549 } ) ;
4650 } ) ;
4751
@@ -66,7 +70,9 @@ describe('App basic features', () => {
6670 installationStore,
6771 } ) ;
6872 // biome-ignore lint/complexity/useLiteralKeys: reaching into private fields
69- assert . propertyVal ( app [ 'receiver' ] , 'httpServerPort' , 9999 ) ;
73+ assert . ok ( app [ 'receiver' ] && typeof app [ 'receiver' ] === 'object' ) ;
74+ assert . ok ( 'httpServerPort' in app [ 'receiver' ] ) ;
75+ assert . deepStrictEqual ( ( app [ 'receiver' ] as unknown as Record < PropertyKey , unknown > ) [ 'httpServerPort' ] , 9999 ) ;
7076 } ) ;
7177 it ( 'should accept a port value under installerOptions' , async ( ) => {
7278 const MockApp = importApp ( overrides ) ;
@@ -83,7 +89,9 @@ describe('App basic features', () => {
8389 installationStore,
8490 } ) ;
8591 // biome-ignore lint/complexity/useLiteralKeys: reaching into private fields
86- assert . propertyVal ( app [ 'receiver' ] , 'httpServerPort' , 9999 ) ;
92+ assert . ok ( app [ 'receiver' ] && typeof app [ 'receiver' ] === 'object' ) ;
93+ assert . ok ( 'httpServerPort' in app [ 'receiver' ] ) ;
94+ assert . deepStrictEqual ( ( app [ 'receiver' ] as unknown as Record < PropertyKey , unknown > ) [ 'httpServerPort' ] , 9999 ) ;
8795 } ) ;
8896 } ) ;
8997
@@ -94,12 +102,12 @@ describe('App basic features', () => {
94102 const MockApp = importApp ( overrides ) ;
95103 const app = new MockApp ( { token : '' , signingSecret : '' } ) ;
96104 // TODO: verify that the fake bot ID and fake bot user ID are retrieved
97- assert . instanceOf ( app , MockApp ) ;
105+ assert . ok ( app instanceof MockApp ) ;
98106 } ) ;
99107 it ( 'should pass the given token to app.client' , async ( ) => {
100108 const MockApp = importApp ( overrides ) ;
101109 const app = new MockApp ( { token : 'xoxb-foo-bar' , signingSecret : '' } ) ;
102- assert . isDefined ( app . client ) ;
110+ assert . notStrictEqual ( app . client , undefined ) ;
103111 assert . equal ( app . client . token , 'xoxb-foo-bar' ) ;
104112 } ) ;
105113 } ) ;
@@ -115,7 +123,9 @@ describe('App basic features', () => {
115123 new MockApp ( { signingSecret : '' } ) ;
116124 assert . fail ( ) ;
117125 } catch ( error ) {
118- assert . propertyVal ( error , 'code' , ErrorCode . AppInitializationError ) ;
126+ assert . ok ( error && typeof error === 'object' ) ;
127+ assert . ok ( 'code' in error ) ;
128+ assert . deepStrictEqual ( ( error as unknown as Record < PropertyKey , unknown > ) [ 'code' ] , ErrorCode . AppInitializationError ) ;
119129 }
120130 } ) ;
121131 it ( 'should fail when both a token and authorize callback are specified' , async ( ) => {
@@ -125,7 +135,9 @@ describe('App basic features', () => {
125135 new MockApp ( { token : '' , authorize : authorizeCallback , signingSecret : '' } ) ;
126136 assert . fail ( ) ;
127137 } catch ( error ) {
128- assert . propertyVal ( error , 'code' , ErrorCode . AppInitializationError ) ;
138+ assert . ok ( error && typeof error === 'object' ) ;
139+ assert . ok ( 'code' in error ) ;
140+ assert . deepStrictEqual ( ( error as unknown as Record < PropertyKey , unknown > ) [ 'code' ] , ErrorCode . AppInitializationError ) ;
129141 assert ( authorizeCallback . notCalled ) ;
130142 }
131143 } ) ;
@@ -136,7 +148,9 @@ describe('App basic features', () => {
136148 new MockApp ( { token : '' , clientId : '' , clientSecret : '' , stateSecret : '' , signingSecret : '' } ) ;
137149 assert . fail ( ) ;
138150 } catch ( error ) {
139- assert . propertyVal ( error , 'code' , ErrorCode . AppInitializationError ) ;
151+ assert . ok ( error && typeof error === 'object' ) ;
152+ assert . ok ( 'code' in error ) ;
153+ assert . deepStrictEqual ( ( error as unknown as Record < PropertyKey , unknown > ) [ 'code' ] , ErrorCode . AppInitializationError ) ;
140154 assert ( authorizeCallback . notCalled ) ;
141155 }
142156 } ) ;
@@ -153,7 +167,9 @@ describe('App basic features', () => {
153167 } ) ;
154168 assert . fail ( ) ;
155169 } catch ( error ) {
156- assert . propertyVal ( error , 'code' , ErrorCode . AppInitializationError ) ;
170+ assert . ok ( error && typeof error === 'object' ) ;
171+ assert . ok ( 'code' in error ) ;
172+ assert . deepStrictEqual ( ( error as unknown as Record < PropertyKey , unknown > ) [ 'code' ] , ErrorCode . AppInitializationError ) ;
157173 assert ( authorizeCallback . notCalled ) ;
158174 }
159175 } ) ;
@@ -172,7 +188,9 @@ describe('App basic features', () => {
172188 new MockApp ( { authorize : noop } ) ;
173189 assert . fail ( ) ;
174190 } catch ( error ) {
175- assert . propertyVal ( error , 'code' , ErrorCode . AppInitializationError ) ;
191+ assert . ok ( error && typeof error === 'object' ) ;
192+ assert . ok ( 'code' in error ) ;
193+ assert . deepStrictEqual ( ( error as unknown as Record < PropertyKey , unknown > ) [ 'code' ] , ErrorCode . AppInitializationError ) ;
176194 }
177195 } ) ;
178196 it ( 'should fail when both socketMode and a custom receiver are specified' , async ( ) => {
@@ -182,7 +200,9 @@ describe('App basic features', () => {
182200 new MockApp ( { token : '' , signingSecret : '' , socketMode : true , receiver : fakeReceiver } ) ;
183201 assert . fail ( ) ;
184202 } catch ( error ) {
185- assert . propertyVal ( error , 'code' , ErrorCode . AppInitializationError ) ;
203+ assert . ok ( error && typeof error === 'object' ) ;
204+ assert . ok ( 'code' in error ) ;
205+ assert . deepStrictEqual ( ( error as unknown as Record < PropertyKey , unknown > ) [ 'code' ] , ErrorCode . AppInitializationError ) ;
186206 }
187207 } ) ;
188208 it ( 'should succeed when both socketMode and SocketModeReceiver are specified' , async ( ) => {
@@ -221,7 +241,7 @@ describe('App basic features', () => {
221241 const dummyConvoStore = createFakeConversationStore ( ) ;
222242 const MockApp = importApp ( overrides ) ;
223243 const app = new MockApp ( { convoStore : dummyConvoStore , authorize : noop , signingSecret : '' } ) ;
224- assert . instanceOf ( app , MockApp ) ;
244+ assert . ok ( app instanceof MockApp ) ;
225245 assert ( fakeConversationContext . firstCall . calledWith ( dummyConvoStore ) ) ;
226246 } ) ;
227247 } ) ;
@@ -232,7 +252,9 @@ describe('App basic features', () => {
232252 new MockApp ( { token : '' , signingSecret : '' , redirectUri : 'http://example.com/redirect' } ) ; // eslint-disable-line no-new
233253 assert . fail ( ) ;
234254 } catch ( error ) {
235- assert . propertyVal ( error , 'code' , ErrorCode . AppInitializationError ) ;
255+ assert . ok ( error && typeof error === 'object' ) ;
256+ assert . ok ( 'code' in error ) ;
257+ assert . deepStrictEqual ( ( error as unknown as Record < PropertyKey , unknown > ) [ 'code' ] , ErrorCode . AppInitializationError ) ;
236258 }
237259 } ) ;
238260 it ( 'should fail when missing installerOptions.redirectUriPath' , async ( ) => {
@@ -246,7 +268,9 @@ describe('App basic features', () => {
246268 } ) ;
247269 assert . fail ( ) ;
248270 } catch ( error ) {
249- assert . propertyVal ( error , 'code' , ErrorCode . AppInitializationError ) ;
271+ assert . ok ( error && typeof error === 'object' ) ;
272+ assert . ok ( 'code' in error ) ;
273+ assert . deepStrictEqual ( ( error as unknown as Record < PropertyKey , unknown > ) [ 'code' ] , ErrorCode . AppInitializationError ) ;
250274 }
251275 } ) ;
252276 } ) ;
@@ -307,23 +331,23 @@ describe('App basic features', () => {
307331 signingSecret : 'invalid-one' ,
308332 deferInitialization : true ,
309333 } ) ;
310- assert . instanceOf ( app , MockApp ) ;
334+ assert . ok ( app instanceof MockApp ) ;
311335 try {
312336 await app . start ( ) ;
313337 assert . fail ( 'The start() method should fail before init() call' ) ;
314338 } catch ( err ) {
315- assert . propertyVal (
316- err ,
317- 'message' ,
318- 'This App instance is not yet initialized. Call `await App#init()` before starting the app.' ,
319- ) ;
339+ assert . ok ( err && typeof err === 'object' ) ;
340+ assert . ok ( 'message' in err ) ;
341+ assert . deepStrictEqual ( ( err as unknown as Record < PropertyKey , unknown > ) [ 'message' ] , 'This App instance is not yet initialized. Call `await App#init()` before starting the app.' ) ;
320342 }
321343 try {
322344 await app . init ( ) ;
323345 assert . fail ( 'The init() method should fail here' ) ;
324346 } catch ( err ) {
325347 console . log ( err ) ;
326- assert . propertyVal ( err , 'message' , exception ) ;
348+ assert . ok ( err && typeof err === 'object' ) ;
349+ assert . ok ( 'message' in err ) ;
350+ assert . deepStrictEqual ( ( err as unknown as Record < PropertyKey , unknown > ) [ 'message' ] , exception ) ;
327351 }
328352 } ) ;
329353 } ) ;
@@ -337,8 +361,12 @@ describe('App basic features', () => {
337361 const fakeLogger = createFakeLogger ( ) ;
338362 const MockApp = importApp ( overrides ) ;
339363 const app = new MockApp ( { logger : fakeLogger , token : '' , appToken : fakeAppToken , developerMode : true } ) ;
340- assert . propertyVal ( app , 'logLevel' , LogLevel . DEBUG ) ;
341- assert . propertyVal ( app , 'socketMode' , true ) ;
364+ assert . ok ( app && typeof app === 'object' ) ;
365+ assert . ok ( 'logLevel' in app ) ;
366+ assert . deepStrictEqual ( ( app as unknown as Record < PropertyKey , unknown > ) [ 'logLevel' ] , LogLevel . DEBUG ) ;
367+ assert . ok ( app && typeof app === 'object' ) ;
368+ assert . ok ( 'socketMode' in app ) ;
369+ assert . deepStrictEqual ( ( app as unknown as Record < PropertyKey , unknown > ) [ 'socketMode' ] , true ) ;
342370 } ) ;
343371 } ) ;
344372
0 commit comments