Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 061bbd8

Browse files
committed
Fix client import in test, also verify config works after reloading stream info from server.
1 parent e67d00a commit 061bbd8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

test/integration/Stream.test.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import StreamrClient from '../../src'
1+
import StreamrClient from '../../src/StreamrClient'
22
import { uid, fakePrivateKey, getPublishTestMessages } from '../utils'
33

44
import config from './config'
@@ -51,7 +51,7 @@ describe('Stream', () => {
5151

5252
expect(stream.config.fields).toEqual([])
5353
await stream.detectFields()
54-
expect(stream.config.fields).toEqual([
54+
const expectedFields = [
5555
{
5656
name: 'number',
5757
type: 'number',
@@ -72,7 +72,11 @@ describe('Stream', () => {
7272
name: 'string',
7373
type: 'string',
7474
},
75-
])
75+
]
76+
77+
expect(stream.config.fields).toEqual(expectedFields)
78+
const loadedStream = await client.getStream(stream.id)
79+
expect(loadedStream.config.fields).toEqual(expectedFields)
7680
})
7781

7882
it('skips unsupported types', async () => {
@@ -82,6 +86,7 @@ describe('Stream', () => {
8286
func: () => null,
8387
nonexistent: undefined,
8488
symbol: Symbol('test'),
89+
// TODO: bigint: 10n,
8590
}
8691
const publishTestMessages = getPublishTestMessages(client, {
8792
streamId: stream.id,
@@ -92,7 +97,7 @@ describe('Stream', () => {
9297

9398
expect(stream.config.fields).toEqual([])
9499
await stream.detectFields()
95-
expect(stream.config.fields).toEqual([
100+
const expectedFields = [
96101
{
97102
name: 'null',
98103
type: 'map',
@@ -101,7 +106,12 @@ describe('Stream', () => {
101106
name: 'empty',
102107
type: 'map',
103108
},
104-
])
109+
]
110+
111+
expect(stream.config.fields).toEqual(expectedFields)
112+
113+
const loadedStream = await client.getStream(stream.id)
114+
expect(loadedStream.config.fields).toEqual(expectedFields)
105115
})
106116
})
107117
})

0 commit comments

Comments
 (0)