Skip to content

Commit cf50282

Browse files
committed
fix: use create instead of bulkCreate
1 parent 2fdf791 commit cf50282

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed

test/e2e/LangsScenario.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ describe('GET api/langs', () => {
1717
{lang_slug: 'py3', lang_name: 'Python 3', lang_version: '3.6'},
1818
{lang_slug: 'java8', lang_name: 'Java', lang_version: '1.8'}
1919
]);
20-
await DB.apikeys.bulkCreate([
21-
{id: 1, key: APIKEY, whitelist_domains: ['*'], whitelist_ips: ['*']}
22-
]);
20+
await DB.apikeys.create({
21+
id: 1,
22+
key: APIKEY,
23+
whitelist_domains: ['*'],
24+
whitelist_ips: ['*']
25+
});
2326
});
2427
after(utils.truncateTables);
2528

test/e2e/RunScenario.spec.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ function delay(ms: number) {
3030

3131
describe('POST api/runs', () => {
3232
before(async () => {
33-
await DB.apikeys.bulkCreate([
34-
{id: 1, key: APIKEY, whitelist_domains: ['*'], whitelist_ips: ['*']}
35-
]);
36-
await DB.langs.bulkCreate([
37-
{lang_slug: 'cpp', lang_name: 'C++', lang_version: '11'}
38-
]);
33+
await DB.apikeys.create({
34+
id: 1,
35+
key: APIKEY,
36+
whitelist_domains: ['*'],
37+
whitelist_ips: ['*']
38+
});
39+
await DB.langs.create({
40+
lang_slug: 'cpp',
41+
lang_name: 'C++',
42+
lang_version: '11'
43+
});
3944
await utils.setupMockQueue()
4045
});
4146
after(utils.truncateTables);

test/e2e/SubmitScenario.spec.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,17 @@ function delay(ms: number) {
4242

4343
describe('POST api/submissions', () => {
4444
before(async () => {
45-
await DB.apikeys.bulkCreate([
46-
{id: 1, key: APIKEY, whitelist_domains: ['*'], whitelist_ips: ['*']}
47-
]);
48-
await DB.langs.bulkCreate([
49-
{lang_slug: 'cpp', lang_name: 'C++', lang_version: '11'}
50-
]);
45+
await DB.apikeys.create({
46+
id: 1,
47+
key: APIKEY,
48+
whitelist_domains: ['*'],
49+
whitelist_ips: ['*']
50+
});
51+
await DB.langs.create({
52+
lang_slug: 'cpp',
53+
lang_name: 'C++',
54+
lang_version: '11'
55+
});
5156
await utils.setupMockQueue();
5257

5358
});

test/unit/validators/ApiKeyValidator.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ const APIKEY = '7718330d2794406c980bdbded6c9dc1d';
1212

1313
describe('API Key Validtors', async () => {
1414
beforeEach(async () => {
15-
await DB.apikeys.bulkCreate([
16-
{key: APIKEY, whitelist_domains: ['*'], whitelist_ips: ['*']}
17-
]);
15+
await DB.apikeys.create({
16+
key: APIKEY, whitelist_domains: ['*'],
17+
whitelist_ips: ['*']
18+
});
1819
});
1920
afterEach(utils.truncateTables);
2021

@@ -86,9 +87,10 @@ describe('API Key Validtors', async () => {
8687
it('should NOT reject api with a whitelist domain', async () => {
8788
const currentKey = 'SDLKJFLSJDKCWEKRJC';
8889

89-
await DB.apikeys.bulkCreate([
90-
{key: currentKey, whitelist_domains: ['Referer']}
91-
]);
90+
await DB.apikeys.create({
91+
key: currentKey,
92+
whitelist_domains: ['Referer']
93+
});
9294

9395
// @ts-ignore
9496
const req: Request = {

0 commit comments

Comments
 (0)