File tree Expand file tree Collapse file tree 3 files changed +87
-2
lines changed Expand file tree Collapse file tree 3 files changed +87
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"type" : " module" ,
3
- "main" : " ../lib/browser/index.mjs" ,
4
- "types" : " ../lib/browser/index.d.mts" ,
3
+ "main" : " ../lib/browser/index.js" ,
4
+ "module" : " ../lib/browser/index.mjs" ,
5
+ "types" : " ../lib/browser/index.d.ts" ,
5
6
"exports" : {
6
7
"." : {
7
8
"module-sync" : {
Original file line number Diff line number Diff line change
1
+ import { http , HttpResponse , graphql } from 'msw'
2
+ import { setupServer } from 'msw/node'
3
+
4
+ it ( 'does not produce a type error when called without arguments' , ( ) => {
5
+ setupServer ( )
6
+ } )
7
+
8
+ it ( 'accepts a single HTTP request handler' , ( ) => {
9
+ setupServer (
10
+ http . get ( '/user' , ( ) => {
11
+ return HttpResponse . json ( { name : 'John Doe' } )
12
+ } ) ,
13
+ )
14
+ setupServer (
15
+ http . get ( '/user' , async ( ) => {
16
+ return HttpResponse . json ( { name : 'John Doe' } )
17
+ } ) ,
18
+ )
19
+ } )
20
+
21
+ it ( 'accepts a single GraphQL request handler' , ( ) => {
22
+ setupServer (
23
+ graphql . query ( 'GetUser' , ( ) => {
24
+ return HttpResponse . json ( { data : { name : 'John Doe' } } )
25
+ } ) ,
26
+ )
27
+ setupServer (
28
+ graphql . query ( 'GetUser' , async ( ) => {
29
+ return HttpResponse . json ( { data : { name : 'John Doe' } } )
30
+ } ) ,
31
+ )
32
+ } )
33
+
34
+ it ( 'supports a list of request handlers defined elsewhere' , ( ) => {
35
+ const handlers = [
36
+ http . get ( '/user' , ( ) => {
37
+ return HttpResponse . json ( { name : 'John Doe' } )
38
+ } ) ,
39
+ ]
40
+
41
+ setupServer ( ...handlers )
42
+ } )
Original file line number Diff line number Diff line change
1
+ import { http , HttpResponse , graphql } from 'msw'
2
+ import { setupWorker } from 'msw/browser'
3
+
4
+ it ( 'does not produce a type error when called without arguments' , ( ) => {
5
+ setupWorker ( )
6
+ } )
7
+
8
+ it ( 'accepts a single HTTP request handler' , ( ) => {
9
+ setupWorker (
10
+ http . get ( '/user' , ( ) => {
11
+ return HttpResponse . json ( { name : 'John Doe' } )
12
+ } ) ,
13
+ )
14
+ setupWorker (
15
+ http . get ( '/user' , async ( ) => {
16
+ return HttpResponse . json ( { name : 'John Doe' } )
17
+ } ) ,
18
+ )
19
+ } )
20
+
21
+ it ( 'accepts a single GraphQL request handler' , ( ) => {
22
+ setupWorker (
23
+ graphql . query ( 'GetUser' , ( ) => {
24
+ return HttpResponse . json ( { data : { name : 'John Doe' } } )
25
+ } ) ,
26
+ )
27
+ setupWorker (
28
+ graphql . query ( 'GetUser' , async ( ) => {
29
+ return HttpResponse . json ( { data : { name : 'John Doe' } } )
30
+ } ) ,
31
+ )
32
+ } )
33
+
34
+ it ( 'supports a list of request handlers defined elsewhere' , ( ) => {
35
+ const handlers = [
36
+ http . get ( '/user' , ( ) => {
37
+ return HttpResponse . json ( { name : 'John Doe' } )
38
+ } ) ,
39
+ ]
40
+
41
+ setupWorker ( ...handlers )
42
+ } )
You can’t perform that action at this time.
0 commit comments