| 131 | } |
| 132 | |
| 133 | export default class TestBackend implements Implementation { |
| 134 | mediaFolder: string; |
| 135 | options: { initialWorkflowStatus?: string }; |
| 136 | |
| 137 | constructor(config: Config, options = {}) { |
| 138 | this.options = options; |
| 139 | this.mediaFolder = config.media_folder; |
| 140 | } |
| 141 | |
| 142 | isGitBackend() { |
| 143 | return false; |
| 144 | } |
| 145 | |
| 146 | status() { |
| 147 | return Promise.resolve({ auth: { status: true }, api: { status: true, statusPage: '' } }); |
| 148 | } |
| 149 | |
| 150 | authComponent() { |
| 151 | return AuthenticationPage; |
| 152 | } |
| 153 | |
| 154 | restoreUser() { |
| 155 | return this.authenticate(); |
| 156 | } |
| 157 | |
| 158 | authenticate() { |
| 159 | return Promise.resolve() as unknown as Promise<User>; |
| 160 | } |
| 161 | |
| 162 | logout() { |
| 163 | return null; |
| 164 | } |
| 165 | |
| 166 | getToken() { |
| 167 | return Promise.resolve(''); |
| 168 | } |
| 169 | |
| 170 | traverseCursor(cursor: Cursor, action: string) { |
| 171 | const { folder, extension, index, pageCount, depth } = cursor.data!.toObject() as { |
| 172 | folder: string; |
| 173 | extension: string; |
| 174 | index: number; |
| 175 | pageCount: number; |
| 176 | depth: number; |
| 177 | }; |
| 178 | const newIndex = (() => { |
| 179 | if (action === 'next') { |
| 180 | return (index as number) + 1; |
| 181 | } |
| 182 | if (action === 'prev') { |
| 183 | return (index as number) - 1; |
| 184 | } |
| 185 | if (action === 'first') { |
| 186 | return 0; |
| 187 | } |
| 188 | if (action === 'last') { |
| 189 | return pageCount; |
| 190 | } |
nothing calls this directly
no outgoing calls
no test coverage detected