mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-13 15:00:06 -04:00
Add UserData ioDevice for setting and getting username from blocks
This commit is contained in:
parent
378fd672fc
commit
6d4c6df692
5 changed files with 56 additions and 4 deletions
test/unit
25
test/unit/io_userData.js
Normal file
25
test/unit/io_userData.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const test = require('tap').test;
|
||||
const UserData = require('../../src/io/userData');
|
||||
|
||||
test('spec', t => {
|
||||
const userData = new UserData();
|
||||
|
||||
t.type(userData, 'object');
|
||||
t.type(userData.postData, 'function');
|
||||
t.type(userData.getUsername, 'function');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('getUsername returns empty string initially', t => {
|
||||
const userData = new UserData();
|
||||
|
||||
t.strictEquals(userData.getUsername(), '');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('postData sets the username', t => {
|
||||
const userData = new UserData();
|
||||
userData.postData({username: 'TEST'});
|
||||
t.strictEquals(userData.getUsername(), 'TEST');
|
||||
t.end();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue