Skip to content

Commit e42a618

Browse files
committed
chore: update tests
1 parent 48c986a commit e42a618

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

src/tests/configurableDirs.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ describe('next-on-netlify', () => {
4545
})
4646

4747
test('creates a Netlify Function for each SSR page', () => {
48-
expect(existsSync(join(functionsDir, 'next_index', 'next_index.js'))).toBe(true)
49-
expect(existsSync(join(functionsDir, 'next_shows_id', 'next_shows_id.js'))).toBe(true)
50-
expect(existsSync(join(functionsDir, 'next_shows_params', 'next_shows_params.js'))).toBe(true)
51-
expect(existsSync(join(functionsDir, 'next_getServerSideProps_static', 'next_getServerSideProps_static.js'))).toBe(
48+
expect(existsSync(join(functionsDir, 'next_index', 'next_index.ts'))).toBe(true)
49+
expect(existsSync(join(functionsDir, 'next_shows_id', 'next_shows_id.ts'))).toBe(true)
50+
expect(existsSync(join(functionsDir, 'next_shows_params', 'next_shows_params.ts'))).toBe(true)
51+
expect(existsSync(join(functionsDir, 'next_getServerSideProps_static', 'next_getServerSideProps_static.ts'))).toBe(
5252
true,
5353
)
54-
expect(existsSync(join(functionsDir, 'next_getServerSideProps_id', 'next_getServerSideProps_id.js'))).toBe(true)
54+
expect(existsSync(join(functionsDir, 'next_getServerSideProps_id', 'next_getServerSideProps_id.ts'))).toBe(true)
5555
})
5656

5757
test('copies static pages to output directory', () => {

src/tests/defaults.test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,24 @@ describe('SSR Pages', () => {
6161
const functionsDir = join(PROJECT_PATH, 'out_functions')
6262

6363
test('creates a Netlify Function for each SSR page', () => {
64-
expect(existsSync(join(functionsDir, 'next_index', 'next_index.js'))).toBe(true)
65-
expect(existsSync(join(functionsDir, 'next_shows_id', 'next_shows_id.js'))).toBe(true)
66-
expect(existsSync(join(functionsDir, 'next_shows_params', 'next_shows_params.js'))).toBe(true)
67-
expect(existsSync(join(functionsDir, 'next_getServerSideProps_static', 'next_getServerSideProps_static.js'))).toBe(
64+
expect(existsSync(join(functionsDir, 'next_index', 'next_index.ts'))).toBe(true)
65+
expect(existsSync(join(functionsDir, 'next_shows_id', 'next_shows_id.ts'))).toBe(true)
66+
expect(existsSync(join(functionsDir, 'next_shows_params', 'next_shows_params.ts'))).toBe(true)
67+
expect(existsSync(join(functionsDir, 'next_getServerSideProps_static', 'next_getServerSideProps_static.ts'))).toBe(
6868
true,
6969
)
70-
expect(existsSync(join(functionsDir, 'next_getServerSideProps_id', 'next_getServerSideProps_id.js'))).toBe(true)
70+
expect(existsSync(join(functionsDir, 'next_getServerSideProps_id', 'next_getServerSideProps_id.ts'))).toBe(true)
7171
})
7272
})
7373

7474
describe('API Pages', () => {
7575
const functionsDir = join(PROJECT_PATH, 'out_functions')
7676

7777
test('creates a Netlify Function for each API endpoint', () => {
78-
expect(existsSync(join(functionsDir, 'next_api_static', 'next_api_static.js'))).toBe(true)
79-
expect(existsSync(join(functionsDir, 'next_api_shows_id', 'next_api_shows_id.js'))).toBe(true)
80-
expect(existsSync(join(functionsDir, 'next_api_shows_params', 'next_api_shows_params.js'))).toBe(true)
81-
expect(existsSync(join(functionsDir, 'next_api_hello-background', 'next_api_hello-background.js'))).toBe(true)
78+
expect(existsSync(join(functionsDir, 'next_api_static', 'next_api_static.ts'))).toBe(true)
79+
expect(existsSync(join(functionsDir, 'next_api_shows_id', 'next_api_shows_id.ts'))).toBe(true)
80+
expect(existsSync(join(functionsDir, 'next_api_shows_params', 'next_api_shows_params.ts'))).toBe(true)
81+
expect(existsSync(join(functionsDir, 'next_api_hello-background', 'next_api_hello-background.ts'))).toBe(true)
8282
})
8383
})
8484

@@ -119,10 +119,10 @@ describe('SSG Pages with getStaticProps', () => {
119119
})
120120

121121
test('creates Netlify Functions for pages with fallback', () => {
122-
const functionPath1 = 'next_getStaticProps_withFallback_id/next_getStaticProps_withFallback_id.js'
122+
const functionPath1 = 'next_getStaticProps_withFallback_id/next_getStaticProps_withFallback_id.ts'
123123
expect(existsSync(join(PROJECT_PATH, 'out_functions', functionPath1))).toBe(true)
124124

125-
const functionPath2 = 'next_getStaticProps_withFallback_slug/next_getStaticProps_withFallback_slug.js'
125+
const functionPath2 = 'next_getStaticProps_withFallback_slug/next_getStaticProps_withFallback_slug.ts'
126126
expect(existsSync(join(PROJECT_PATH, 'out_functions', functionPath2))).toBe(true)
127127
})
128128
})
@@ -132,19 +132,19 @@ describe('SSG Pages with getStaticProps and revalidate', () => {
132132

133133
test('creates a Netlify Function for each page', () => {
134134
expect(
135-
existsSync(join(functionsDir, 'next_getStaticProps_withrevalidate', 'next_getStaticProps_withrevalidate.js')),
135+
existsSync(join(functionsDir, 'next_getStaticProps_withrevalidate', 'next_getStaticProps_withrevalidate.ts')),
136136
).toBe(true)
137137
expect(
138138
existsSync(
139-
join(functionsDir, 'next_getStaticProps_withRevalidate_id', 'next_getStaticProps_withRevalidate_id.js'),
139+
join(functionsDir, 'next_getStaticProps_withRevalidate_id', 'next_getStaticProps_withRevalidate_id.ts'),
140140
),
141141
).toBe(true)
142142
expect(
143143
existsSync(
144144
join(
145145
functionsDir,
146146
'next_getStaticProps_withRevalidate_withFallback_id',
147-
'next_getStaticProps_withRevalidate_withFallback_id.js',
147+
'next_getStaticProps_withRevalidate_withFallback_id.ts',
148148
),
149149
),
150150
).toBe(true)

src/tests/i18n.test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,23 @@ describe('SSR Pages', () => {
6161
const functionsDir = join(PROJECT_PATH, 'out_functions')
6262

6363
test('creates a Netlify Function for each SSR page', () => {
64-
expect(existsSync(join(functionsDir, 'next_index', 'next_index.js'))).toBe(true)
65-
expect(existsSync(join(functionsDir, 'next_shows_id', 'next_shows_id.js'))).toBe(true)
66-
expect(existsSync(join(functionsDir, 'next_shows_params', 'next_shows_params.js'))).toBe(true)
67-
expect(existsSync(join(functionsDir, 'next_getServerSideProps_static', 'next_getServerSideProps_static.js'))).toBe(
64+
expect(existsSync(join(functionsDir, 'next_index', 'next_index.ts'))).toBe(true)
65+
expect(existsSync(join(functionsDir, 'next_shows_id', 'next_shows_id.ts'))).toBe(true)
66+
expect(existsSync(join(functionsDir, 'next_shows_params', 'next_shows_params.ts'))).toBe(true)
67+
expect(existsSync(join(functionsDir, 'next_getServerSideProps_static', 'next_getServerSideProps_static.ts'))).toBe(
6868
true,
6969
)
70-
expect(existsSync(join(functionsDir, 'next_getServerSideProps_id', 'next_getServerSideProps_id.js'))).toBe(true)
70+
expect(existsSync(join(functionsDir, 'next_getServerSideProps_id', 'next_getServerSideProps_id.ts'))).toBe(true)
7171
})
7272
})
7373

7474
describe('API Pages', () => {
7575
const functionsDir = join(PROJECT_PATH, 'out_functions')
7676

7777
test('creates a Netlify Function for each API endpoint', () => {
78-
expect(existsSync(join(functionsDir, 'next_api_static', 'next_api_static.js'))).toBe(true)
79-
expect(existsSync(join(functionsDir, 'next_api_shows_id', 'next_api_shows_id.js'))).toBe(true)
80-
expect(existsSync(join(functionsDir, 'next_api_shows_params', 'next_api_shows_params.js'))).toBe(true)
78+
expect(existsSync(join(functionsDir, 'next_api_static', 'next_api_static.ts'))).toBe(true)
79+
expect(existsSync(join(functionsDir, 'next_api_shows_id', 'next_api_shows_id.ts'))).toBe(true)
80+
expect(existsSync(join(functionsDir, 'next_api_shows_params', 'next_api_shows_params.ts'))).toBe(true)
8181
})
8282
})
8383

@@ -110,10 +110,10 @@ describe('SSG Pages with getStaticProps', () => {
110110
})
111111

112112
test('creates Netlify Functions for pages with fallback', () => {
113-
const functionPath1 = 'next_getStaticProps_withFallback_id/next_getStaticProps_withFallback_id.js'
113+
const functionPath1 = 'next_getStaticProps_withFallback_id/next_getStaticProps_withFallback_id.ts'
114114
expect(existsSync(join(PROJECT_PATH, 'out_functions', functionPath1))).toBe(true)
115115

116-
const functionPath2 = 'next_getStaticProps_withFallback_slug/next_getStaticProps_withFallback_slug.js'
116+
const functionPath2 = 'next_getStaticProps_withFallback_slug/next_getStaticProps_withFallback_slug.ts'
117117
expect(existsSync(join(PROJECT_PATH, 'out_functions', functionPath2))).toBe(true)
118118
})
119119
})
@@ -123,19 +123,19 @@ describe('SSG Pages with getStaticProps and revalidate', () => {
123123

124124
test('creates a Netlify Function for each page', () => {
125125
expect(
126-
existsSync(join(functionsDir, 'next_getStaticProps_withrevalidate', 'next_getStaticProps_withrevalidate.js')),
126+
existsSync(join(functionsDir, 'next_getStaticProps_withrevalidate', 'next_getStaticProps_withrevalidate.ts')),
127127
).toBe(true)
128128
expect(
129129
existsSync(
130-
join(functionsDir, 'next_getStaticProps_withRevalidate_id', 'next_getStaticProps_withRevalidate_id.js'),
130+
join(functionsDir, 'next_getStaticProps_withRevalidate_id', 'next_getStaticProps_withRevalidate_id.ts'),
131131
),
132132
).toBe(true)
133133
expect(
134134
existsSync(
135135
join(
136136
functionsDir,
137137
'next_getStaticProps_withRevalidate_withFallback_id',
138-
'next_getStaticProps_withRevalidate_withFallback_id.js',
138+
'next_getStaticProps_withRevalidate_withFallback_id.ts',
139139
),
140140
),
141141
).toBe(true)

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe('onBuild()', () => {
256256
utils,
257257
})
258258

259-
expect(await pathExists(`${resolvedFunctions}/next_api_test/next_api_test.js`)).toBeTruthy()
259+
expect(await pathExists(`${resolvedFunctions}/next_api_test/next_api_test.ts`)).toBeTruthy()
260260
})
261261
})
262262

0 commit comments

Comments
 (0)