Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded node and pnpm using hermit #793

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/corepack
2 changes: 1 addition & 1 deletion bin/node
2 changes: 1 addition & 1 deletion bin/npm
2 changes: 1 addition & 1 deletion bin/npx
2 changes: 1 addition & 1 deletion bin/pnpm
4 changes: 2 additions & 2 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"@types/mocha": "10.0.1",
"@types/ms": "0.7.31",
"@types/node": "20.11.19",
"@types/sinon": "17.0.2",
"@types/sinon": "17.0.3",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.14.1",
"@web/test-runner": "0.18.2",
Expand All @@ -107,7 +107,7 @@
"node-stdlib-browser": "1.2.0",
"playwright": "1.45.3",
"rimraf": "4.4.0",
"sinon": "16.1.3",
"sinon": "18.0.0",
"typescript": "5.1.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import { expect } from 'chai';

import { DwnServerInfoCache, ServerInfo } from '../../../src/prototyping/clients/server-info-types.js';
import { DwnServerInfoCacheMemory } from '../../../src/prototyping/clients/dwn-server-info-cache-memory.js';
import { isNode } from '../../utils/runtimes.js';

describe('DwnServerInfoCache', () => {

describe(`DwnServerInfoCacheMemory`, () => {
let cache: DwnServerInfoCache;
let clock: sinon.SinonFakeTimers;

const exampleInfo:ServerInfo = {
maxFileSize : 100,
Expand All @@ -23,14 +21,12 @@ describe('DwnServerInfoCache', () => {
});

beforeEach(() => {
clock = sinon.useFakeTimers();
cache = new DwnServerInfoCacheMemory();
});

afterEach(async () => {
await cache.clear();
await cache.close();
clock.restore();
});

it('sets server info in cache', async () => {
Expand Down Expand Up @@ -96,11 +92,9 @@ describe('DwnServerInfoCache', () => {
});

it('returns undefined after ttl', async function () {
// skip this test in the browser, sinon fake timers don't seem to work here
// with a an await setTimeout in the test, it passes.
if (!isNode) {
this.skip();
}
// NOTE: tried very hard to use sinon.useFakeTimers() but couldn't get it to work with `TtlCache` implementation in `DwnServerInfoCacheMemory`.
// I sanity added a setInterval here, and it obeys the fake time ticks and its callback is fired, but the `TtlCache` just ignores the fake timer ticks.
cache = new DwnServerInfoCacheMemory({ ttl: '100ms'});

const key = 'some-key1';
await cache.set(key, { ...exampleInfo });
Expand All @@ -109,8 +103,8 @@ describe('DwnServerInfoCache', () => {
expect(result!.webSocketSupport).to.deep.equal(true);
expect(result).to.deep.equal(exampleInfo);

// wait until 15m default ttl is up
await clock.tickAsync('15:01');
// sleep for 100ms
await new Promise((resolve) => setTimeout(resolve, 100));

const resultAfter = await cache.get(key);
expect(resultAfter).to.be.undefined;
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading