diff --git a/packages/cache/test/cacheable/23.class-decorator.controller.test.ts b/packages/cache/test/cacheable/23.class-decorator.controller.test.ts new file mode 100644 index 000000000..d470b791c --- /dev/null +++ b/packages/cache/test/cacheable/23.class-decorator.controller.test.ts @@ -0,0 +1,47 @@ +import assert from 'node:assert/strict' + +import { fileShortPath } from '@waiting/shared-core' + +import { apiBase, apiMethod } from '#@/api-test.js' +import { testConfig } from '#@/root.config.js' + + +describe(fileShortPath(import.meta.url), function () { + describe('Should @Cacheable decorator work', () => { + const prefix = apiBase.class_cacheable + + it(apiMethod.simple, async () => { + const { httpRequest } = testConfig + const url = `${prefix}/${apiMethod.simple}` + + const resp = await httpRequest.get(url) + assert(resp.ok, resp.text) + }) + + it(apiMethod.method_override_class, async () => { + const { httpRequest } = testConfig + const url = `${prefix}/${apiMethod.method_override_class}` + + const resp = await httpRequest.get(url) + assert(resp.ok, resp.text) + }) + + + it(apiMethod.ttlFn, async () => { + const { httpRequest } = testConfig + const url = `${prefix}/${apiMethod.ttlFn}` + + const resp = await httpRequest.get(url) + assert(resp.ok, resp.text) + }) + + it(apiMethod.ttl_fn2, async () => { + const { httpRequest } = testConfig + const url = `${prefix}/${apiMethod.ttl_fn2}` + + const resp = await httpRequest.get(url) + assert(resp.ok, resp.text) + }) + }) +}) + diff --git a/packages/cache/test/cacheput/40.simple.test.ts b/packages/cache/test/cacheput/40.simple.test.ts deleted file mode 100644 index 4ccd8d22a..000000000 --- a/packages/cache/test/cacheput/40.simple.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import assert from 'node:assert/strict' - -import { fileShortPath } from '@waiting/shared-core' - -import { apiBase, apiMethod } from '#@/api-test.js' -import { testConfig } from '#@/root.config.js' - - -describe(fileShortPath(import.meta.url), function () { - describe('Should @Cacheable decorator work', () => { - const prefix = apiBase.method_cacheput - - it(apiMethod.simple, async () => { - const { httpRequest } = testConfig - const url = `${prefix}/${apiMethod.simple}` - - const resp = await httpRequest - .get(url) - .expect(200) - - assert(resp) - }) - - }) -}) - diff --git a/packages/cache/test/fixtures/base-app/src/cacheable/23a.class-decorator.controller.ts b/packages/cache/test/fixtures/base-app/src/cacheable/23a.class-decorator.controller.ts index b56fdef1c..2017b85bc 100644 --- a/packages/cache/test/fixtures/base-app/src/cacheable/23a.class-decorator.controller.ts +++ b/packages/cache/test/fixtures/base-app/src/cacheable/23a.class-decorator.controller.ts @@ -115,7 +115,7 @@ export class ClassDecoratorController { validateMeta(ret3a, `${cacheKey}:foo`, ttl) console.log(2012) - await sleep(ttl * 1001) + await sleep(ttl * 1002) const ret4 = await this.svc.ttlFn('foo') console.log(2013)