Skip to content

Commit

Permalink
Implement CacheInterface, better JSON serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
doochik committed Nov 18, 2024
1 parent 9796fe5 commit 1045d7d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/httpBlock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import strip_null_and_undefined_values from '../lib/stripNullAndUndefinedValues'
import type { DescriptBlockOptions, DescriptHttpBlockResult } from '../lib/types';
import type { DescriptHttpBlockDescription } from '../lib/httpBlock';
import type { DescriptBlockId } from '../lib/depsDomain';
import { expect } from '@jest/globals';
// --------------------------------------------------------------------------------------------------------------- //

describe('http', <
Expand Down Expand Up @@ -995,6 +996,7 @@ describe('http', <
};
fake.add(path, (req: ClientRequest, res: ServerResponse) => {
const buffer = Buffer.from(JSON.stringify(RESPONSE));
res.setHeader('x-foo', 'bar');
res.setHeader('content-length', Buffer.byteLength(buffer));
res.setHeader('content-type', 'application/json; charset=utf-8');
res.end(buffer);
Expand All @@ -1012,13 +1014,11 @@ describe('http', <
const result = await de.run(block);

expect(JSON.parse(result)).toEqual({
headers: {
connection: 'keep-alive',
headers: expect.objectContaining({
'content-length': '24',
'content-type': 'application/json; charset=utf-8',
date: expect.stringMatching(/^.* GMT$/),
'keep-alive': 'timeout=5',
},
'x-foo': 'bar',
}),
result: {
text: 'Привет!',
},
Expand Down

0 comments on commit 1045d7d

Please sign in to comment.