mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
chore(): resolve conflicts
This commit is contained in:
18
integration/cache/e2e/multi-store.spec.ts
vendored
18
integration/cache/e2e/multi-store.spec.ts
vendored
@@ -1,7 +1,7 @@
|
||||
import * as request from 'supertest';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { MultiStoreModule } from '../src/multi-store/multi-store.module';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import * as request from 'supertest';
|
||||
import { MultiStoreModule } from '../src/multi-store/multi-store.module';
|
||||
|
||||
describe('Caching Multi Store', () => {
|
||||
let server;
|
||||
@@ -17,16 +17,12 @@ describe('Caching Multi Store', () => {
|
||||
await app.init();
|
||||
});
|
||||
|
||||
it(`Should return empty`, async () => {
|
||||
return request(server)
|
||||
.get('/')
|
||||
.expect(200, '');
|
||||
it(`should return empty`, async () => {
|
||||
return request(server).get('/').expect(200, '');
|
||||
});
|
||||
|
||||
it(`Should return data`, async () => {
|
||||
return request(server)
|
||||
.get('/')
|
||||
.expect(200, 'multi-store-value');
|
||||
it(`should return data`, async () => {
|
||||
return request(server).get('/').expect(200, 'multi-store-value');
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
|
||||
@@ -27,10 +27,19 @@ export class KafkaParser {
|
||||
return data;
|
||||
}
|
||||
|
||||
public decode(value: Buffer): object | string | null {
|
||||
public decode(value: Buffer): object | string | null | Buffer {
|
||||
if (isNil(value)) {
|
||||
return null;
|
||||
}
|
||||
// A value with the "leading zero byte" indicates the schema payload.
|
||||
// The "content" is possibly binary and should not be touched & parsed.
|
||||
if (
|
||||
Buffer.isBuffer(value) &&
|
||||
value.length > 0 &&
|
||||
value.readUInt8(0) === 0
|
||||
) {
|
||||
return value;
|
||||
}
|
||||
|
||||
let result = value.toString();
|
||||
const startChar = result.charAt(0);
|
||||
|
||||
@@ -43,6 +43,18 @@ describe('KafkaParser', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('binary buffer using kafka schema registry preamble', () => {
|
||||
const kafkaSchemaPreambleWithSchemaId = [0x00, 0x00, 0x00, 0x00, 0x01];
|
||||
expect(
|
||||
KafkaParser.parse({
|
||||
value: Buffer.from(kafkaSchemaPreambleWithSchemaId),
|
||||
}),
|
||||
).to.deep.eq({
|
||||
headers: {},
|
||||
value: Buffer.from(kafkaSchemaPreambleWithSchemaId),
|
||||
});
|
||||
});
|
||||
|
||||
it('buffer number', () => {
|
||||
expect(
|
||||
kafkaParser.parse({
|
||||
|
||||
Reference in New Issue
Block a user