encode only community's name in channel URL (#358)
This commit is contained in:
parent
a5830bec1c
commit
54b2f53242
|
@ -9,6 +9,9 @@ import {
|
||||||
encodeUserURLData,
|
encodeUserURLData,
|
||||||
} from './encode-url-data'
|
} from './encode-url-data'
|
||||||
|
|
||||||
|
import type { Channel } from '../protos/url-data_pb'
|
||||||
|
import type { PlainMessage } from '@bufbuild/protobuf'
|
||||||
|
|
||||||
describe('Encode URL data', () => {
|
describe('Encode URL data', () => {
|
||||||
test('should encode and decode community', () => {
|
test('should encode and decode community', () => {
|
||||||
const data = {
|
const data = {
|
||||||
|
@ -39,19 +42,16 @@ describe('Encode URL data', () => {
|
||||||
uuid: '30804ea7-bd66-4d5d-91eb-b2dcfe2515b3',
|
uuid: '30804ea7-bd66-4d5d-91eb-b2dcfe2515b3',
|
||||||
community: {
|
community: {
|
||||||
displayName: 'Lorem ipsum dolor sit egestas.',
|
displayName: 'Lorem ipsum dolor sit egestas.',
|
||||||
description:
|
|
||||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus non dui vitae augue elementum laoreet ac pharetra odio. Morbi vestibulum.',
|
|
||||||
membersCount: 1_000_000,
|
|
||||||
color: '#4360DF',
|
|
||||||
tagIndices: [1, 2, 3, 4],
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const encodedData = encodeChannelURLData(data)
|
const encodedData = encodeChannelURLData(
|
||||||
|
data as unknown as PlainMessage<Channel>
|
||||||
|
)
|
||||||
const decodedData = decodeChannelURLData(encodedData)
|
const decodedData = decodeChannelURLData(encodedData)
|
||||||
|
|
||||||
expect(encodedData).toBe(
|
expect(encodedData).toBe(
|
||||||
'G70BYJwHdqxloHnQV-SSlY7OfdEB_f8igUIHtomMR1igUTaaRSFVBhJ-mjSn8BPqdBHk0PiHrEsBk8WBTo6_gK0tSiwQDLCWpwnmKeU2Bo7j005CuygCCwWebictMe-XLrHfyPEUmLllOKoRCBtcLDALSYQvF5NCoieM550vx-sAmlmSK871edYL67bCK-PPYghGByWEGNMFs9lOIoFx2H_mJDkNNs9bYsbbaRl_uoStzrokUn0u578yAg16mYwLh-287482y4Ibg9640rAW9JNkrfwstJ2qbLLXJ2CYUOa5ftZlFZk2TnzTxIGvfdznZLVXePelos5rWwI='
|
'GxoBQCwO7MbOG73h9C_ECmmNLFveFT5wVETFRTal3e2y0Xyou1sfFAV-SsZH0MTwwDRpTuEnp26giuDkQ9algElBJsdfwJYmFggG1GoJJJjnNgaO49Oj0C6qYIaxnbTEvF-6xH6jxmPg5oHSFAguuFhgFpIIby42hURPGM87X47XATSzJGec5_OsF9ZthVfGzWIIRgcltFjTBbPZTiKBcdj_5iQ5DTbPW4LaTsu46RK2OuuSPOXd-ddgstj0g6uYHm2WBUDBjYa1oPniW2ZdVpFpY-ubJq587eM-JytEhXc_Kuq8tiU='
|
||||||
)
|
)
|
||||||
expect(decodedData).toEqual(data)
|
expect(decodedData).toEqual(data)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue