Skip to content

Commit ce18121

Browse files
committed
reorg tests
jsr changes
1 parent ff2359c commit ce18121

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+254
-335
lines changed

src/connect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import type {
1818
NatsConnection,
1919
Transport,
2020
TransportFactory,
21-
} from "@nats-io/nats-core/internal";
21+
} from "jsr:@nats-io/nats-core@3.0.0-11/internal";
2222

2323
import {
2424
NatsConnectionImpl,
2525
setTransportFactory,
26-
} from "@nats-io/nats-core/internal";
26+
} from "jsr:@nats-io/nats-core@3.0.0-11/internal";
2727

2828
export function connect(opts: ConnectionOptions = {}): Promise<NatsConnection> {
2929
setTransportFactory({

src/deno.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "@nats-io/nats-transport-deno",
3-
"version": "3.0.0-2",
3+
"version": "3.0.0-3",
44
"exports": {
55
".": "./mod.ts"
66
},
77
"publish": {
88
"include": [
9-
"./**/*"
9+
"./*"
1010
]
1111
},
1212
"imports": {
13-
"@nats-io/nats-core/internal": "jsr:@nats-io/[email protected]/internal",
14-
"@nats-io/nats-core": "jsr:@nats-io/[email protected]1",
15-
"@std/io": "jsr:@std/[email protected]"
13+
"jsr:@std/io": "jsr:@std/[email protected]",
14+
"jsr:@nats-io/nats-core": "jsr:@nats-io/[email protected]2",
15+
"jsr:@nats-io/nats-core/internal": "jsr:@nats-io/[email protected]/internal"
1616
}
1717
}

src/deno_transport.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ import {
2424
INFO,
2525
NatsError,
2626
render,
27-
} from "@nats-io/nats-core/internal";
27+
} from "jsr:@nats-io/nats-core@3.0.0-11/internal";
2828

2929
import type {
3030
ConnectionOptions,
3131
Deferred,
3232
ServerInfo,
3333
TlsOptions,
3434
Transport,
35-
} from "@nats-io/nats-core/internal";
35+
} from "jsr:@nats-io/nats-core@3.0.0-11/internal";
3636

37-
import { writeAll } from "@std/io";
37+
import { writeAll } from "jsr:@std/io";
3838

3939
const VERSION = "1.25.0";
4040
const LANG = "nats.deno";

src/mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export { connect } from "./connect.ts";
2-
export * from "@nats-io/nats-core";
2+
export * from "jsr:@nats-io/nats-core@3.0.0-11";

tests/auth_test.ts renamed to src/tests/auth_test.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,47 @@
1414
*/
1515

1616
import {
17+
assert,
1718
assertArrayIncludes,
1819
assertEquals,
1920
assertRejects,
2021
fail,
21-
} from "https://deno.land/[email protected]/assert/mod.ts";
22+
} from "jsr:@std/assert";
23+
import { connect } from "../mod.ts";
2224
import {
23-
connect,
2425
createInbox,
2526
credsAuthenticator,
27+
deferred,
2628
Empty,
2729
ErrorCode,
2830
Events,
2931
jwtAuthenticator,
30-
NatsConnection,
31-
NatsError,
32-
NKeyAuth,
3332
nkeyAuthenticator,
34-
Status,
33+
nkeys,
3534
StringCodec,
3635
tokenAuthenticator,
3736
usernamePasswordAuthenticator,
37+
} from "../mod.ts";
38+
import type {
39+
NatsConnection,
40+
NatsError,
41+
NKeyAuth,
42+
Status,
3843
UserPass,
39-
} from "../src/mod.ts";
44+
} from "../mod.ts";
4045
import { assertErrorCode, cleanup, NatsServer, setup } from "./helpers/mod.ts";
41-
import {
42-
deferred,
43-
MsgImpl,
44-
NatsConnectionImpl,
45-
nkeys,
46-
} from "../nats-base-client/internal_mod.ts";
47-
import { assert } from "../nats-base-client/denobuffer.ts";
4846
import {
4947
encodeAccount,
5048
encodeOperator,
5149
encodeUser,
52-
} from "https://raw.githubusercontent.com/nats-io/jwt.js/main/src/jwt.ts";
53-
54-
import { DEFAULT_MAX_RECONNECT_ATTEMPTS } from "../nats-base-client/options.ts";
50+
} from "jsr:@nats-io/[email protected]";
51+
import type {
52+
MsgImpl,
53+
NatsConnectionImpl,
54+
} from "jsr:@nats-io/[email protected]/internal";
55+
import {
56+
DEFAULT_MAX_RECONNECT_ATTEMPTS,
57+
} from "jsr:@nats-io/[email protected]/internal";
5558

5659
const conf = {
5760
authorization: {

tests/authenticator_test.ts renamed to src/tests/authenticator_test.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2023 The NATS Authors
2+
* Copyright 2022-2024 The NATS Authors
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
55
* You may obtain a copy of the License at
@@ -15,28 +15,30 @@
1515

1616
import { cleanup, setup } from "./helpers/mod.ts";
1717
import {
18-
Auth,
19-
Authenticator,
2018
credsAuthenticator,
2119
deferred,
2220
Events,
2321
jwtAuthenticator,
24-
NatsConnection,
2522
nkeyAuthenticator,
23+
nkeys,
2624
tokenAuthenticator,
2725
usernamePasswordAuthenticator,
28-
} from "../nats-base-client/mod.ts";
29-
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
30-
import { nkeys } from "../nats-base-client/nkeys.ts";
26+
} from "../mod.ts";
27+
import type { Auth, Authenticator, NatsConnection } from "../mod.ts";
28+
29+
import { deadline, delay } from "jsr:@nats-io/[email protected]/internal";
30+
import type {
31+
NatsConnectionImpl,
32+
} from "jsr:@nats-io/[email protected]/internal";
33+
34+
import { assertEquals } from "jsr:@std/assert";
3135
import {
3236
encodeAccount,
3337
encodeOperator,
3438
encodeUser,
3539
fmtCreds,
36-
} from "https://raw.githubusercontent.com/nats-io/jwt.js/main/src/jwt.ts";
40+
} from "jsr:@nats-io/jwt@0.0.9-3";
3741
import { assertBetween } from "./helpers/mod.ts";
38-
import { deadline, delay } from "../nats-base-client/util.ts";
39-
import { NatsConnectionImpl } from "../nats-base-client/nats.ts";
4042

4143
function disconnectReconnect(nc: NatsConnection): Promise<void> {
4244
const done = deferred<void>();

tests/autounsub_test.ts renamed to src/tests/autounsub_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
15+
import { assert, assertEquals } from "jsr:@std/assert";
1616

17-
import { createInbox, Empty, ErrorCode, Subscription } from "../src/mod.ts";
17+
import { createInbox, Empty, ErrorCode } from "../mod.ts";
18+
import type { Subscription } from "../mod.ts";
19+
import type { NatsConnectionImpl } from "jsr:@nats-io/[email protected]/internal";
1820
import { cleanup, Lock, setup } from "./helpers/mod.ts";
19-
import type { NatsConnectionImpl } from "../nats-base-client/nats.ts";
20-
import { assert } from "../nats-base-client/denobuffer.ts";
2121

2222
Deno.test("autounsub - max option", async () => {
2323
const { ns, nc } = await setup();

tests/basics_test.ts renamed to src/tests/basics_test.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,27 @@ import {
2020
assertRejects,
2121
assertThrows,
2222
fail,
23-
} from "https://deno.land/[email protected]/assert/mod.ts";
23+
} from "jsr:@std/assert";
2424

2525
import { assertThrowsAsyncErrorCode } from "./helpers/asserts.ts";
2626

2727
import {
2828
connect,
2929
createInbox,
30+
deferred,
31+
delay,
3032
Empty,
3133
ErrorCode,
34+
headers,
3235
JSONCodec,
3336
jwtAuthenticator,
34-
Msg,
3537
NatsError,
3638
nuid,
39+
RequestStrategy,
3740
StringCodec,
38-
} from "../src/mod.ts";
41+
syncIterator,
42+
} from "../mod.ts";
43+
import type { Msg, Payload, PublishOptions } from "../mod.ts";
3944
import {
4045
assertErrorCode,
4146
cleanup,
@@ -44,24 +49,16 @@ import {
4449
NatsServer,
4550
setup,
4651
} from "./helpers/mod.ts";
47-
import {
48-
collect,
49-
deferred,
50-
delay,
51-
headers,
52-
isIP,
52+
import type { MsgHdrs, Publisher } from "../mod.ts";
53+
import type {
5354
NatsConnectionImpl,
54-
Payload,
55-
PublishOptions,
56-
RequestStrategy,
5755
SubscriptionImpl,
58-
} from "../nats-base-client/internal_mod.ts";
59-
import { Feature } from "../nats-base-client/semver.ts";
60-
import { syncIterator } from "../nats-base-client/core.ts";
56+
} from "jsr:@nats-io/[email protected]/internal";
6157
import {
62-
MsgHdrs,
63-
Publisher,
64-
} from "https://deno.land/x/[email protected]/nats-base-client/core.ts";
58+
collect,
59+
Feature,
60+
isIP,
61+
} from "jsr:@nats-io/[email protected]/internal";
6562

6663
Deno.test("basics - connect port", async () => {
6764
const ns = await NatsServer.start();

tests/bench_test.ts renamed to src/tests/bench_test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
import {
16-
assert,
17-
assertEquals,
18-
assertThrows,
19-
} from "https://deno.land/[email protected]/assert/mod.ts";
20-
import { Bench, connect, createInbox } from "../src/mod.ts";
21-
import { BenchOpts, Metric } from "../nats-base-client/bench.ts";
15+
import { assert, assertEquals, assertThrows } from "jsr:@std/assert";
16+
import { Bench, connect, createInbox, Metric } from "../mod.ts";
17+
import type { BenchOpts } from "../mod.ts";
2218

2319
const u = "demo.nats.io:4222";
2420

tests/binary_test.ts renamed to src/tests/binary_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
17-
import { createInbox, Msg } from "../src/mod.ts";
18-
import { deferred } from "../nats-base-client/internal_mod.ts";
16+
import { assertEquals } from "jsr:@std/assert";
17+
import { createInbox, deferred } from "../mod.ts";
18+
import type { Msg } from "../mod.ts";
1919
import { cleanup, setup } from "./helpers/mod.ts";
2020

2121
function macro(input: Uint8Array) {

tests/buffer_test.ts renamed to src/tests/buffer_test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@
77
// This code removes all Deno specific functionality to enable its use
88
// in a browser environment
99

10-
import {
11-
assert,
12-
assertEquals,
13-
assertThrows,
14-
} from "https://deno.land/[email protected]/assert/mod.ts";
10+
import { assert, assertEquals, assertThrows } from "jsr:@std/assert";
1511
import {
1612
DenoBuffer,
1713
MAX_SIZE,
1814
readAll,
1915
writeAll,
20-
} from "../nats-base-client/internal_mod.ts";
16+
} from "jsr:@nats-io/nats-[email protected]/internal";
2117

2218
// N controls how many iterations of certain checks are performed.
2319
const N = 100;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/clobber_test.ts renamed to src/tests/clobber_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
*/
1515

1616
import { NatsServer } from "./helpers/launcher.ts";
17-
import { createInbox, DataBuffer } from "../nats-base-client/internal_mod.ts";
18-
import { connect } from "../src/mod.ts";
19-
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
17+
import { DataBuffer } from "jsr:@nats-io/nats-[email protected]/internal";
18+
import { connect, createInbox } from "../mod.ts";
19+
import { assertEquals } from "jsr:@std/assert";
2020

2121
function makeBuffer(N: number): Uint8Array {
2222
const buf = new Uint8Array(N);

tests/codec_test.ts renamed to src/tests/codec_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
import { JSONCodec, StringCodec } from "../nats-base-client/codec.ts";
16-
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
15+
import { JSONCodec, StringCodec } from "../mod.ts";
16+
import { assertEquals } from "jsr:@std/assert";
1717

1818
Deno.test("codec - string", () => {
1919
const sc = StringCodec();

tests/databuffer_test.ts renamed to src/tests/databuffer_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts";
16-
import { DataBuffer } from "../nats-base-client/internal_mod.ts";
15+
import { assertEquals } from "jsr:@std/assert";
16+
import { DataBuffer } from "jsr:@nats-io/nats-[email protected]/internal";
1717

1818
Deno.test("databuffer - empty", () => {
1919
const buf = new DataBuffer();

tests/disconnect_test.ts renamed to src/tests/disconnect_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { connect } from "../src/mod.ts";
16+
import { connect } from "../mod.ts";
1717
import { Lock, NatsServer } from "./helpers/mod.ts";
18-
import type { NatsConnectionImpl } from "../nats-base-client/internal_mod.ts";
18+
import type { NatsConnectionImpl } from "jsr:@nats-io/nats-[email protected]/internal";
1919

2020
Deno.test("disconnect - close handler is called on close", async () => {
2121
const ns = await NatsServer.start();

tests/doublesubs_test.ts renamed to src/tests/doublesubs_test.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,20 @@
1313
* limitations under the License.
1414
*/
1515
import { NatsServer } from "./helpers/launcher.ts";
16-
import { connect } from "../src/connect.ts";
1716
import {
17+
connect,
1818
deferred,
1919
Empty,
2020
Events,
2121
headers,
22-
NatsConnectionImpl,
2322
StringCodec,
24-
} from "../nats-base-client/internal_mod.ts";
25-
import {
26-
assertArrayIncludes,
27-
assertEquals,
28-
} from "https://deno.land/[email protected]/assert/mod.ts";
29-
import { extend } from "../nats-base-client/util.ts";
30-
import { join, resolve } from "https://deno.land/[email protected]/path/mod.ts";
23+
} from "../mod.ts";
24+
import type {
25+
NatsConnectionImpl,
26+
} from "jsr:@nats-io/[email protected]/internal";
27+
import { extend } from "jsr:@nats-io/[email protected]/internal";
28+
import { assertArrayIncludes, assertEquals } from "jsr:@std/assert";
29+
import { join, resolve } from "jsr:@std/path";
3130

3231
async function runDoubleSubsTest(tls: boolean) {
3332
const cwd = Deno.cwd();

0 commit comments

Comments
 (0)