summaryrefslogtreecommitdiff
path: root/packages/integrations/node/test/api-route.test.js
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2024-01-25 16:17:31 +0000
committerGravatar GitHub <noreply@github.com> 2024-01-25 16:17:31 +0000
commit4f010d71a1416b5ff5b956cd84bf7afe86bf0530 (patch)
tree6cfad2505f01a6444a275149d42855e51236ca73 /packages/integrations/node/test/api-route.test.js
parent9248f540338de9bbea3dfdbe65f7148fe2e4eb14 (diff)
downloadastro-4f010d71a1416b5ff5b956cd84bf7afe86bf0530.tar.gz
astro-4f010d71a1416b5ff5b956cd84bf7afe86bf0530.tar.zst
astro-4f010d71a1416b5ff5b956cd84bf7afe86bf0530.zip
chore(@astrojs/node): use Node.js for testing (#9758)
* chore(@astrojs/node): use Node.js for testing * revert file * address feedback * feedback * Run tests in a single process (#9823) * Run tests in a single process * Make test less flaky * chore: remove module --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Diffstat (limited to 'packages/integrations/node/test/api-route.test.js')
-rw-r--r--packages/integrations/node/test/api-route.test.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/integrations/node/test/api-route.test.js b/packages/integrations/node/test/api-route.test.js
index 313819188..80e99a2cc 100644
--- a/packages/integrations/node/test/api-route.test.js
+++ b/packages/integrations/node/test/api-route.test.js
@@ -1,7 +1,8 @@
import nodejs from '../dist/index.js';
import { loadFixture, createRequestAndResponse } from './test-utils.js';
-import { expect } from 'chai';
import crypto from 'node:crypto';
+import { describe, it, before } from 'node:test';
+import * as assert from 'node:assert/strict';
describe('API routes', () => {
/** @type {import('./test-utils').Fixture} */
@@ -33,9 +34,9 @@ describe('API routes', () => {
let json = JSON.parse(buffer.toString('utf-8'));
- expect(json.length).to.equal(1);
+ assert.equal(json.length, 1);
- expect(json[0].name).to.equal('Broccoli Soup');
+ assert.equal(json[0].name, 'Broccoli Soup');
});
it('Can get binary data', async () => {
@@ -54,7 +55,7 @@ describe('API routes', () => {
let [out] = await done;
let arr = Array.from(new Uint8Array(out.buffer));
- expect(arr).to.deep.equal([5, 4, 3, 2, 1]);
+ assert.deepEqual(arr, [5, 4, 3, 2, 1]);
});
it('Can post large binary data', async () => {
@@ -87,7 +88,7 @@ describe('API routes', () => {
});
let [out] = await done;
- expect(new Uint8Array(out.buffer)).to.deep.equal(expectedDigest);
+ assert.deepEqual(new Uint8Array(out.buffer), new Uint8Array(expectedDigest));
});
it('Can bail on streaming', async () => {
@@ -106,6 +107,6 @@ describe('API routes', () => {
await done;
- expect(locals).to.deep.include({ cancelledByTheServer: true });
+ assert.deepEqual(locals, { cancelledByTheServer: true });
});
});