-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
64 additions
and
60 deletions.
There are no files selected for viewing
9 changes: 5 additions & 4 deletions
9
test/app/extends/cliFilter.test.js → test/app/extends/cliFilter.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
test/app/extends/escapeShellArg.test.js → test/app/extends/escapeShellArg.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
test/app/extends/escapeShellCmd.test.js → test/app/extends/escapeShellCmd.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 13 additions & 10 deletions
23
test/app/extends/helper.test.js → test/app/extends/helper.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
test/app/extends/sjs.test.js → test/app/extends/sjs.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
test/app/extends/sjson.test.js → test/app/extends/sjson.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
test/app/extends/spath.test.js → test/app/extends/spath.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
const { strict: assert } = require('node:assert'); | ||
const mm = require('egg-mock'); | ||
import { strict as assert } from 'node:assert'; | ||
import { mm, MockApplication } from '@eggjs/mock'; | ||
|
||
describe('test/context.test.js', () => { | ||
describe('test/context.test.ts', () => { | ||
afterEach(mm.restore); | ||
|
||
describe('context.isSafeDomain', () => { | ||
let app; | ||
let app: MockApplication; | ||
before(() => { | ||
app = mm.app({ | ||
baseDir: 'apps/isSafeDomain-custom', | ||
}); | ||
return app.ready(); | ||
}); | ||
|
||
after(() => app.close()); | ||
|
||
it('should return false when domains are not safe', async () => { | ||
const res = await app.httpRequest() | ||
.get('/unsafe') | ||
.set('accept', 'text/html') | ||
.expect(200); | ||
assert(res.text === 'false'); | ||
assert.equal(res.text, 'false'); | ||
}); | ||
|
||
it('should return true when domains are safe', async () => { | ||
const res = await app.httpRequest() | ||
.get('/safe') | ||
.set('accept', 'text/html') | ||
.expect(200); | ||
assert(res.text === 'true'); | ||
assert.equal(res.text, 'true'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
test/fixtures/apps/csrf-string-cookiedomain/app/controller/home.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters