Skip to content

Commit 7e5b067

Browse files
HTTP methods + cleanup
1 parent 23ee7e5 commit 7e5b067

4 files changed

Lines changed: 1101 additions & 26128 deletions

File tree

packages/manager/.mocks/entities/linodes.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,36 @@ export const linodeList = defineMockEntity<Linode>({
5656
updated: overrides.updated ?? new Date().toISOString(),
5757
watchdog_enabled: overrides.watchdog_enabled ?? true,
5858
}),
59-
fields: {
60-
status: ['running', 'offline', 'booting', 'rebooting', 'shutting_down'],
61-
region: ['us-east', 'eu-west', 'ap-southeast'],
62-
},
59+
});
60+
61+
// GET single linode
62+
export const linodeGet = defineMockEntity<Linode>({
63+
name: 'linodes',
64+
endpoint: '/v4beta/linode/instances/:id',
65+
method: 'GET',
66+
factory: linodeList.factory,
67+
});
68+
69+
// PUT (update) a linode — echoes body back, writes to store if storeKey set
70+
export const linodePut = defineMockEntity<Linode>({
71+
name: 'linodes',
72+
endpoint: '/v4beta/linode/instances/:id',
73+
method: 'PUT',
74+
factory: linodeList.factory,
75+
});
76+
77+
// DELETE a linode — always returns 204, no factory needed
78+
export const linodeDelete = defineMockEntity({
79+
name: 'linodes',
80+
endpoint: '/v4/linode/instances/:id',
81+
method: 'DELETE',
82+
factory: () => ({}),
83+
});
84+
85+
// POST (create) a linode — echoes body back
86+
export const linodeCreate = defineMockEntity<Linode>({
87+
name: 'linodes',
88+
endpoint: '/v4beta/linode/instances',
89+
method: 'POST',
90+
factory: linodeList.factory,
6391
});

packages/manager/.mocks/presets/default.json

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)